rjx44
rjx44

Reputation: 389

is it possible to make a custom page in buddypress

is it possible to make a custom page for buddypress with its url like this: http://domain.com/custom_page ? I found some answers by searching google but it does not create a custom page. i have a code here that i found in one of the blogs.

define('BP_FUN_SLUG','fun');

function bp_show_fun_page() {

global $bp, $current_blog;

if ( $bp->current_component == BP_FUN_SLUG && $bp->current_action == '' ) {
    // The first variable here must match the name of your template file below
    bp_core_load_template( 'fun', true );
}

}

add_action( 'wp', 'bp_show_fun_page', 2 );

but this code does not work... Is anyone there knows how to do this? thanks

Upvotes: 1

Views: 3714

Answers (3)

Piotr Kaluza
Piotr Kaluza

Reputation: 413

In case someone is wondering how to integrate custom pages into user profile (so that it looks like activity stream, groups etc.).

One thing i did recently was define a plugin (functions.php would work as well), register a custom slug with bp_core_new_nav_item or bp_core_nav_subnav_item and loaded member/single/plugins.php template in the handlers for those slugs. There are a bunch of actions on that page that you can hook into like bp_template_title and bp_template_content.

This can give you a whole lot of control.

Here's a link to the source of plugins.php: http://phpxref.ftwr.co.uk/buddypress/nav.html?readme.txt.source.html

Upvotes: 0

Chirag Patel
Chirag Patel

Reputation: 506

Yes, it is possible to create a new page in Buddypress. In Buddypress you have to create a new plugin or create a function in the theme functions file.

For creating first you have to add a new page link in navigation menu using bp_core_new_nav_item() function (You have created sub menu for that use bp_core_new_subnav_item() function).

Above two functions pass the screen function name as a parameter this name use when you click the custom page link call to this screen function. Create new function in your functions.php file same as screen function name. In this function call to your custom template file using bp_core_load_template() function.

Then finish, add more logic to create a new function and call it in the template file.

Upvotes: 2

shanebp
shanebp

Reputation: 1956

Another approach is to add a plugin that allows php in posts. For example http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/

Then create a page and add this to it:

[php] locate_template( array( 'some-template-folder/something.php' ), true ); [/php]

Upvotes: 0

Related Questions