• Hi,

    I got a problem on how to display the post correctly under each of the created category page.

    http://fabuloussystem.com/category/product

    The category flow:
    Product > Radio > Lincoln > walkie-talkie > FM 701

    In Product page, it show all post but actually I only wan it to display ” Radio “.

    The same for ” Radio ” page, it suppose to show ONLY ” Lincoln “ but not ” walkie-talkie ” & ” FM 701 “.

    Can anyone help? Appreciate it!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You might want to have a look at this function.

    Thread Starter vickson

    (@vickson)

    Thanks esmi. but which file I should edit?

    If you added the post_is_in_descendant_category function to your theme’s functions.php file, you could then use it in your category template like any other conditional tag:

    <?php $curr_cat = get_category($cat_id);?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if( post_is_in_descendant_category( $curr_cat, $post->ID ) ) continue;?>
    Thread Starter vickson

    (@vickson)

    Hello esmi, after adding the code given by you to my function.php, whole site showing blank page. Anything to add futher?

    Thread Starter vickson

    (@vickson)

    May anyone teach me what should I do for next step to fix my problem? I’m not really good in codex. Pls~ Thanks!

    You need to add the code on the in_category page (post_is_in_descendant_category function ) to functions.php. The snippet I gave was an example of how you might use the function in your theme’s category template file.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display Post Correctly Under Each Category’ is closed to new replies.