I would like to remove blog posts from the home page if they belong to a certain category. How can I go about this in Buddypress (preferably without a plugin)?
Leave a Reply
You must be logged in to post a comment.
I would like to remove blog posts from the home page if they belong to a certain category. How can I go about this in Buddypress (preferably without a plugin)?
You must be logged in to post a comment.
If you mean filtering the home page activity stream by blog post category, it’s not possible using any of the buit in BuddyPress template tags, functions or queries. I struggled with this same issue for months and finally gave up. If someone can prove me wrong I would love to hear the solution.
If your not using the activity stream on your home page you can just use the WP_Query class to filter the posts.
My use case for filtering the blog posts in the activity stream was to have separate activity stream pages for each post category.
The closest thing I could find was the BuddyPress Links Plugin which creates a links post type that uses categories and is integrated into the BuddyPress activity stream but it required to much customization to get it to work how I wanted.
I also spoke with Boone at length at a WordCamp about adding custom meta or categories to any of the BuddyPress components and using the meta to filter the activity stream. He said it can be done but it would have to be completely coded from scratch and is not something nativly supported by BuddyPress. He also said the best way to accomplish this would be to create a new custom BuddyPress component.
Can you explain what your trying to achieve a little bit better. Are you wanting to filter certain categories from certain users or certain categories from all users?
EDIT:
Here are some items i have found on this.
Now i have not tried to see if this works as i do not currently have a buddypress site to mess with and it takes to much to get a test one up and know what your settings are
You can use WordPress custom loop’s inside a BuddyPress theme as long as it makes use of them.
You can find the WordPress loop’s codex page by clicking here and the one you specifically need by click here
Here is the code you would need:
The following line
<?php if ( is_home() ) {
helps buddypress determine that this needs to happen only on the home page.