Add content on the first page of a category

I want to add content on only the first page of a category page then have the posts in that category below and only the additional post on subsequent pages of the category. Previously you showed how to put content at the top of each page ( https://theme.co/apex/forum/t/add-description-to-my-woodworking-category-page-in-integrity/33534/4 ) but that creates a lot of duplicate content which I don’t want.

I am running integrity on a child theme.
Please advise.

Thanks.

Hello There,

Thanks for writing in! You can modify the given code and detect the first page so that the content will only be in the first page. You can use this instead:

function add_category_description() {
    if( is_category() ) {  

    // get current page we are on. If not set we can assume we are on page 1.
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    // are we on page one?
    if(1 == $paged) { ?>
    
      <div class="cat-desc">
          <div class="x-container max width"</div>
              <?php echo  category_description(); ?>
          </div>
      </div>
    <?php }
    }
}
add_action( 'x_after_view_integrity__landmark-header', 'add_category_description',99999 );

Hope this works for you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.