Support Forums for LiveMesh Themes & Plugins › Forums › Squash Theme Support › exclude category from main blog page
- This topic has 3 replies, 3 voices, and was last updated 11 years, 5 months ago by
babaLucas.
-
AuthorPosts
-
July 3, 2013 at 9:48 am #1038
meermakers
MemberHow 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!
July 3, 2013 at 1:39 pm #1043livemesh
KeymasterFor 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.
July 4, 2013 at 3:39 am #1052livemesh
KeymasterFor 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.
November 10, 2014 at 11:32 pm #10405babaLucas
ParticipantI’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?
-
AuthorPosts
- The forum ‘Squash Theme Support’ is closed to new topics and replies.