exclude category from main blog page

Support Forums for LiveMesh Themes & Plugins Forums Squash Theme Support exclude category from main blog page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1038

    How can I hide one (ore more) categories from my main blog page? I have a post category named ‘references’ that needs posts to show up in another page as ‘custom posts’ and I don’t want them to show up on my main blog.

    The same thing I want to achieve on the homepage, but with post snippets.
    Now I’m using:
    [show_post_snippets category_slugs=”all,the,categories,I,want,to,show” …
    but that doesn’t seem to work.

    Can you help me with this? Thanks!


    For post snippets, pls see if something similar to the below should work for posts as well as custom post types like portfolio –

    [show_post_snippets number_of_columns=3 post_count=6 image_size='large' show_meta='false' terms="inspiration,technology" taxonamy="category" post_type="post"]

    For hiding the categories from the main blog, will post the code change you need to make in a day. Thanks for waiting.


    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.

    Rob BalucasbabaLucas

    I’ve been trying to make this work today to only show posts from one category using the code below. But it is not working.

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

    Am I missing something?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Squash Theme Support’ is closed to new topics and replies.