Display Category description

I want display category description only the first page:

I use in my category.php:

<?php if(category_description()) :?>    
<section class="cat-desc"> 
<?php echo category_description(); ?>
</section>
<?php endif; ?>

I try this:

   <?
   if (is_category()) {
   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
   if ($page == 1) {
   echo category_description(); //you don't need to include the category id 
    on the actual category page - wordpress figures it out. 
   }
   }
  ?>  
  <?
  if (is_tag()) {
  $page2 = (get_query_var('paged')) ? get_query_var('paged') : 1;
  if ($page2 == 1) {
  echo tag_description(); //you don't need to include the category id on the 
  actual category page - wordpress figures it out. 
  }
  }
  ?> 

With the Category description is all ok but the tag description is missing.

Thanks.

Answers 1

  • After adding descriptions to your tags, modify your WordPress theme to display the description at the top of each archive page. Open the "Appearance" section of your WordPress website's main menu and select "Editor." Click the "tag.php" link under "Tag Template" on the right side of the page.


Related Questions