Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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)?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

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.

Boone Gorges's (BuddyPress Lead Developer) reply to a support forum topic about using custom post types with BuddyPress:

There isn’t really any support built into BP for custom pay types, but supporting them is no different from supporting other kinds of custom content in BP. See the BuddyPress Skeleton Component for some guidance on integrating custom content into BP navigation, etc.

In the next couple weeks I might whip up a new plugin to provide a framework for custom post type support in BP (front end editing, integration into nav menus, etc). I’ve had to do stuff like this for a couple clients in the past few months and I think I have a sense of some good strategies.

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.

share|improve this answer
add comment

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

  1. This one being the hardest is to download this plugin Front Page Category Filter and grab the code out of it.
  2. According to this quote (found here):

Just as you use “The Loop” to loop through posts in WordPress, each content type in BuddyPress has its own custom loop.

By using these loops in your template, you can output any kind of information and really customize how content is displayed within your BuddyPress theme.

The default BuddyPress theme (/wp-content/themes/bp-default) makes use of all the custom loops available in BuddyPress. It provides a good example of using the loops in real use situations.

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.

<?php if ( is_home() ) { query_posts($query_string . '&cat=-3,-8');} ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<div class="post">

<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<div class="entry">
<?php the_content(); ?>
</div>

<p class="postmetadata">Posted in <?php the_category(', '); ?></p>
</div> <!-- closes the first div box -->

<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
share|improve this answer
    
Hi LRD, Just filter a specific category from all users. –  idea May 1 '11 at 3:12
    
I updated my original answer with something the may or may not help you but lets hope it does –  xLRDxREVENGEx May 1 '11 at 4:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.