A problem when posting in sub Cat (2 posts)

  1. Pickells
    Posted 3 years ago #

    i have this problem

    when i post in a sub category the full post shows also in the parent category !!

    i want to show only partial of the post in the parent and a link to the full post in the sub .

    any help will be appreciated !!

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    category archives are also showing the posts of subcategories by default;

    you would need to edit category.php of your theme (if your theme does not have one, create anew from a copy of archive.php or index.php);

    in the loop, change for example:

    <?php the_content(); ?>


    <?php if( in_category( get_query_var('cat') ) {
    } else {
    } ?>


    the post title would generally already link to the full post.
    if you want to link to the sub category instead, you also need to change the coding ot the_title() line...

Topic Closed

This topic has been closed to new replies.

About this Topic