-
I would like to create a page similar to the posts page but to host only a specific post category, namely ‘case study’. Is it possible to do that?
-
I also need the post category ‘Case study’ not to be published on the main ‘posts page’. I have inserted the following code into ‘functions.php’ without success:
// Exclude a category from recent posts page
// =============================================================================
function x_exclude_cat_from_blog($query) {
if ($query->is_home() && $query->is_main_query()) {
$query->set(‘cat’, ‘-199815’);
}
}
add_action(‘pre_get_posts’, ‘x_exclude_cat_from_blog’);
// =============================================================================
I had a look in the forum but couldn’t find the answer.
Thank you in advance for your help.
Regards
Françoise
Hi Fran,
You can achieve this by using either Essential Grid or The Grid extensions,
create galleries with specific categories and you can also display filters to show posts for a specific category.
Regarding the code, you mentioned, that your code is proper and will work if not conflicting with any existing code.
Regretfully, we do not provide support for custom codes
Thanks
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.