Tagged: x
-
AuthorPosts
-
July 13, 2016 at 5:20 am #1084597
Gee RParticipantHi,
Apologies in advance as I’m sure this has been asked many times before, but I can’t seem to find the right thread to help me.
On the blog index page, I want to display posts from only one category (in my case “news”) and exclude other blog posts tagged with other categories.
July 13, 2016 at 8:02 am #1084806
ThaiModeratorHi There,
TO achieve that, please add the following code under functions.php file locates in your child theme:
function my_home_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '123' ); } } add_action( 'pre_get_posts', 'my_home_category' );After that replace the 123 number with your news category.
Hope it helps π
July 13, 2016 at 8:09 am #1084821
Gee RParticipantThanks – but that’s not working π
July 13, 2016 at 10:17 am #1085004
ThaiModeratorHi There,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
β Link to your site
β WordPress Admin username / passwordDonβt forget to select Set as private reply. This ensures your information is only visible to our staff.
Thanks.
July 13, 2016 at 10:18 am #1085009
Gee RParticipantThanks, but I’ve solved the issue in another way: by using “The Grid”.
π
July 13, 2016 at 11:50 am #1085205
ThaiModeratorGlad you’ve sorted it out.
If you need anything else, please let us know π
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1084597 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
