Limit Blog Template to particular category

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10974
    Rob BalucasbabaLucas
    Participant

    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
    RaghavendraRaghavendra
    Moderator

    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.