Screenshot 2014-12-12 11.45.19

Adding a CSS class to the body when the page is not a BuddyPress page

When I write my CSS/LESS I often use body classes to target elements on specific pages on my site. BuddyPress does a good job of adding it’s own custom body classes to the BuddyPress pages, but it also inherits some of the WordPress classes like .page. The snippet below adds a simple body class wordpress-page to all regular WordPress pages. This allows you to write custom CSS that is only applied to WordPress pages without affecting the styling of BuddyPress content.

Add the following to bp-custom.php

Here’s a quick example of how you could then use this.

.wordpress-page .content {
font-size: 110%;

Have fun theming!

Code Snippets

jQuery functions and the Activity Stream; A Quick Tip

This one is for the theme developers!

When you’re building a custom BuddyPress theme sometimes you need to enhance the activity stream with some jQuery magic. For example if you want to open images in a lightbox, or want to add some custom CSS classes to certain activity entries.  The problem is that when the activity stream fetches new content (when a user clicks the “Load More” button) your functions won’t fire again if you initialise your functions on document ready.

But have no fear, a solution is here. Simply add your magic inside the following code function:


Code Snippets

Block Activity Types from being added to the Activity Stream

The snippet below will allow you to easily block certain activity types from being recorded from the activity stream.

Step 1: Add the following snippet to bp-custom.php

Step 2: Edit the blocked activity types

You can add/remove activity types as you see fit. You can easily find the unique IDs of the activity types by looking at the source of your activity stream with Firebug or Chrome Dev tools

374944803 Block Activity Types from being added to the Activity Stream

That’s it!

Credits: imath on

Screenshot 2014-04-15 17.20.28

How to hide the main site in the “My Sites” admin menu (Multisite)

I needed a simple way to hide the main site from showing up in the WordPress admin bar across my Multisite community. The following snippet shows you how to hide your main site from showing up from everyone except super admins

Add the following to functions.php or your functions plugin

// Add specific CSS class by filter
function my_class_names($classes) {
    if (is_user_logged_in() && !is_super_admin()) {
        $classes[] = 'is-not-super-admin';
    return $classes;

Now add the following CSS to style.css of your theme or your custom.css stylesheet

.is-not-super-admin #wp-admin-bar-blog-1 {
  display: none;

I have not found a way to do this with just a code snippet, but if anyone figured out a way, please do leave a comment!


How to let CBOX install and setup BuddyPress and BBPress for you

This quick tip comes in quite handy for those who are having issues with setting up BuddyPress 1.6+ and the BBPress 2 Forums. The Commons in a Box plugin is meant to make setting up your BuddyPress powered social network a snap. The plugin contains some code written by BuddyPress core developers Boone and R-A-Y which automatically sets up your BBPress Group Forums with BuddyPress.

The CBOX plugin does a ton more than that, but just in case you’re running into issues setting up your forums with BBPress 2, this might be the solution you’re looking for. Here’s all you’d need to do:

  • Install the Commons in a Box plugin
  • Activate the plugin and follow the steps presented to you
  • Enjoy your BBPress 2 forums inside your BuddyPress Groups

As one of the CBOX Developers I’m really proud on how the team handled this, and it’s one of the little touches that make the plugin so easy to use and helpful for many site admins who are new to all of this. You can read more about Commons in a Box on the official website and on our PressCrew site.