Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Extra Page’s in BuddyPress

add this to your bp-custom.php or functions.php file:

/*Define slugs*/
define(‘BP_EXAMPLE_SLUG’, ‘example’); /* this will show up as http://yourdomain.com/example */

/*Add slug as a root component*/
function page_setup_root_component()
{
bp_core_add_root_component( BP_EXAMPLE_SLUG );
}
add_action( ‘plugins_loaded’, ‘page_setup_root_component’, 2 );

/*Show defined slug*/
function bp_show_page() {
global $bp, $current_blog;

if ( $bp->current_component == BP_EXAMPLE_SLUG && $bp->current_action == ” ) {
bp_core_load_template( ‘example’, true ); /*replace example with the name that of the template you upload*/
}
}
add_action( ‘wp’, ‘bp_show_page’, 2 );

/*For extra functionality you can add a title for that page*/
function page_titles( $title, $b ) {
global $bp;

if ( $bp->current_component == BP_Example_SLUG && $bp->current_action == ” ) {
$title = __( ‘Example’, ‘buddypress’ ); /*change Example with what you want the title of your page to be*/
}
return $title;
}
add_filter( ‘bp_page_title’, ‘page_titles’, 10, 2 );

now create an example.php file and add this to it:

get the header with the get_header() bp function

Hello im an example page

testing to see if this works

get the footer with the get_footer() bp function

then upload it to the root of the bp-default theme, it should be at the same level as where the header.php, footer.php files etc.. are
now go to http://yourdomain.com/example and see if it shows..

remember to replace ‘example’ throughout the code with what you want your slug/page to be, the template (example.php or whatever you will call it) that you upload to the theme should be the same as what you call on this line above>> bp_core_load_template( ‘example’, true );

if its working, go ahead and customize as ud like
hope this helps, it works for me, dont know a way to do it through wordpress though as wordpress will load page.php for every page you create so you cant really customize it..

Skip to toolbar