This topic has 2 replies, 2 voices, and was last updated 5 years, 8 months ago ago by Rose Tyler
Hi, we want to exclude some post categories from the “standard” blog page. They should be shown on a different page with a post-grid element.
How can we exclude them? Did not find an option in the xstore theme options?
Also it would be great to show a categories filter on top of the blog page instead of the one in the sidebar (because of mobile)
Many thanks.
Hello,
1) There is no such option by default.
You can use code like this
function exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-1' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
in functions.php of child-theme.
Don’t forget to replace the ID number in the code with the actual ID number of the category you need to remove (in our example the ID number is “1”, “-“ tells us that the category should be excluded).
2) Theme Options > Blog > Blog layout > Sidebar position for mobile.
Regards
You must be logged in to reply to this topic.Log in/Sign up