• Resolved Ashutosh Joshi

    (@ashutoshjoshi)


    My theme shows category description in category archive page. I want that to be shown on main page only, how can I stop sub-pages from showing the description.

    This is my category page, as you will see there is a description of category and if you’ll go through the sub-pages, it is there too. I don’t want it on sub-pages.

    How can I do that? I’m not an expert with codes, so detailed help will be really appreciable.

Viewing 1 replies (of 1 total)
  • Thread Starter Ashutosh Joshi

    (@ashutoshjoshi)

    I tried a lot of things and finally was able to figure it out. Here is the solution. You need to edit category.php file. Find out the code which is calling the category description.
    change that code with following code.

    <?php if ( $paged < 2 ) : ?>
    <?php $categorydesc = category_description(); if ( ! empty( $categorydesc ) ) echo apply_filters( 'archive_meta', '<div class="archive-meta">' . $categorydesc . '</div>' ); ?>
    <?php else : ?>
    <?php endif; ?>

    This code will show the category description only on 1st page of category not subpages. It worked for me, you can check it working here on my Happy holi sms category.

Viewing 1 replies (of 1 total)
  • The topic ‘How can I remove description from sub-pages of Category?’ is closed to new replies.