Tagged: x
-
AuthorPosts
-
December 6, 2016 at 3:09 pm #1283654
twelvetwoParticipantHave a unique situation where I need to exclude a post category from the blog page. Have tried a plugin that claims to do this, but with no luck.
I’m familiar with editing template files, but having trouble isolating where exactly the theme is pulling blog posts. I realize this is out of scope for what you support, but any recommendations would be greatly appreciated.
Thanks!
December 6, 2016 at 10:42 pm #1284060
RupokMemberHi there,
Thanks for writing in! I can help you by hiding the post from certain category with some CSS. If that’s okay for you then provide your URL and mention the category name.
Cheers!
December 7, 2016 at 9:54 am #1284724
twelvetwoParticipantThis reply has been marked as private.December 7, 2016 at 10:47 am #1284780
ThaiModeratorHi There,
Please add the following code under functions.php file locates in your child theme:
function x_exclude_cat_from_home($query) { if ($query->is_home() && $query->is_main_query()) { $query->set('cat', '-123'); } } add_action('pre_get_posts', 'x_exclude_cat_from_home');Replace the 123 number with your category ID.
Hope it helps 🙂
December 7, 2016 at 1:51 pm #1285013
twelvetwoParticipantWow – you guys are awesome! Thank you very much. On my way to leave a 5 star review. 🙂
December 7, 2016 at 7:16 pm #1285417
RadModeratorYou’re so much welcome! Thank you very much 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1283654 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
