Tutorials – Creating a custom Front Page for your BuddyPress Groups



Creating a custom homepage for your group pages is a lot easier then you might think. This Trick will tell you exactly how to create one for one of your groups, that can be easily managed from your WordPress administration menu


Step 1: Download this plugin WP easy post types and activate.

Step 2: Create a post type called Groups

Click the drop down and add new. Add a new post type with the title of a groups slug. Example: say you have a group slug like this groups/bp-tricks, you would then create a group custom type post titled bp-tricks. Add something to the post editor box and hit save.

Important: If you’ve changed the slug of your Groups make sure to use the same name for your Post type!

What we are essentially doing is tricking WP and BP into using the same URL. So by creating a custom post type with the exact URL of a group we can override the front page with a WP page and then use the post editor to create anything.

Step 4: Edit a Template

Go in to your theme folder and open groups/single/home.php

**EDIT LINE 41**
<?php elseif ( bp_group_is_visible() && bp_is_active( 'activity' ) ) : ?>

<?php elseif ( !bp_group_is_visible() ) : ?>


Step 5: Create a new template file

In the same folder groups/single/ create a file called front.php and add the following code and save:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<div class="entry">
<?php the_content(); ?>
<?php endwhile; ?>
<?php else icon confused Creating a custom Front Page for your BuddyPress Groups >

<?php locate_template( array( 'groups/single/activity.php' ), true ) ?>
<?php endif; ?>


Now when you visit a group it will show the custom post type page instead of the activity stream. There are some issues with the Home tab and i’m going to suggest a core change to make the tabs easier to customize.

In the mean time you could use this code to change the Home tab to activity, add this to bp-custom.php:
function my_bp_group_overrides() {
global $bp;

$bp->bp_options_nav['groups']['home']['name'] = 'Activity';
add_action('get_header', 'my_bp_group_overrides');


You now have a custom group homepage which you can fill with content straight from your WordPress admin panel!

From http://bp-tricks.com/