Forums

Post page - only show posts from specific category and its children (3 posts)

  1. davemcc
    Member
    Posted 2 years ago #

    I have been trying to work this out but to no avail!

    I want to show only posts from the category 'shop' and the child categories within shop on the post page.

    ANy help appreciated!

    Thanks

    Dave

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try adding:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'category_name' => 'shop',
    	'paged' => $paged
    );
    query_posts($args);
    ?>

    to the relevant template file just before the start of the Loop.

    http://codex.wordpress.org/Function_Reference/query_posts

  3. davemcc
    Member
    Posted 2 years ago #

    Exellent esmi,

    I will give that a go tomorrow!

    Thanks v much

Topic Closed

This topic has been closed to new replies.

About this Topic