The snippet I found in the above link is as below:
define('BP_EXAMPLE_SLUG', 'fun');
function bp_show_example_page() {
global $bp, $current_blog;
if ( $bp->current_component == BP_EXAMPLE_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_example_page', 2 );
In buddypress, activity, members, group have a definite pages like ‘domain/activity’, ‘domain/members’, ‘domain/group’, respectively. Likewise I’m trying to create my own custom page like ‘domain/mycustom’.
For this purpose I referred John James Jacoby’s Post in here. The snippet used in that link didn’t work for me. I don’t know where I’m missing.
From that snippet, I found that $bp->current_component returns me an empty string.
Even I’ve tried bp_current_component() and bp_is_current_component() functions with no success.
Actually this function works fine when used in default buddypress pages like domain/activity/. This returns me “activity”, which is exactly correct. But when I tried this in my custom page (domain/custompage), I’m getting an empty string.