WordPress.org

Ready to get started?Download WordPress

Forums

Category Description ONLY On First Category Page (4 posts)

  1. eselby
    Member
    Posted 1 year ago #

    What is the conditional code to echo category_description on just the first page of a category archive?

    (client wants to avoid "duplicate content" across multiple category post pages)

  2. chrisjb
    Member
    Posted 1 year ago #

    I'm also looking for conditional for "category first page". I have content displayed above the paginated content, which shouldn't be displayed on category-name/2.

    Did you find the answer to this eselby? I couldn't find anything in the conditionals codex resource.

  3. chrisjb
    Member
    Posted 1 year ago #

    I think I might have found this:

    is_category()&&!is_paged()

    I'll try and see if it works.

  4. Tamanna28
    Member
    Posted 11 months ago #

    use the get_query_var and is_category functions.

    <?get_header()?>
    <?
    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.
      }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic