Limit Blog Template to particular category

Support Forums for LiveMesh Themes & Plugins Forums Agile Theme Support Limit Blog Template to particular category

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by Raghavendra Raghavendra 4 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10974
    Rob Balucas
    babaLucas
    Participant
    Post count: 26

    Hello, I’ve searched the forum & found this below to be the answer to my question, but it doesn’t work for me. I want to limit the blog template to only show category ID 2.

    Go to the theme folder and open the file “template-blog.php”. In line #23, replace the following code:

    $query = array('posts_per_page' => intval(get_option('posts_per_page')), 'ignore_sticky_posts' => 0, 'paged' => $paged);

    With this new one:

    $query = array('posts_per_page' => intval(get_option('posts_per_page')), 'ignore_sticky_posts' => 0, 'paged' => $paged, cat=2);

    I’ve used it in both the child and parent theme; but it hasn’t worked. Am I missing something?

    #10985
    Raghavendra
    Raghavendra
    Moderator
    Post count: 4607

    Can you pls check if the following link helps (utilizes category slug instead of category id) –

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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.