WordPress.org

Ready to get started?Download WordPress

Forums

Yoko
[resolved] How can I remove description from sub-pages of Category? (2 posts)

  1. Ashutosh Joshi
    Member
    Posted 6 months ago #

    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.

  2. Ashutosh Joshi
    Member
    Posted 6 months ago #

    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.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.