Reply To: exclude category from main blog page

#1052
livemesh
Keymaster

For excluding certain categories from the blog, use the modified code below in the {theme folder}/template-blog.php file –

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

where you provide the category ids for the those which need to be excluded from the blog. You can create another blog template with only these excluded posts and no other by having the query as –

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

May be you have a reason to have the current ones as ‘post’ types, otherwise consider having a custom post type in the custom-functions.php file to avoid modifying the blog queries.