Okay, thanks I will try that, although it implies I can’t have a single test for multiple pages, but never mind, I can work around it.
Thanks again…
OK, I tried using bp_is_page(‘activity’) and it [correction] DOES work,
but I noticed dipping into the BP files that bp_is_page() is deprecated.
There is no way to recognise the page using WP core functions is_page() or is_front_page(), true?
Why does is_page(‘activity’) not work? You could try testing for bp_is_current_component(‘activity’) though?
Why does is_page(‘activity’) not work?
I don’t know, that’s why I posted the question.
It seems that if you have a page which you assign one of the BP pages (eg activity) to, then BP somehow hijacks it so that WP is no longer able to recognise it by its slug or, in this case, using is_front_page().
Not sure at what point you’re running the check but simply dumping is_page(‘activity’) out in the header.php of a bp enabled theme only returns true when on activity page.
Not sure about your example of comma separated items didn’t think that worked although you can pass an array.
Maybe you need to do an if( is_home() && bp_is_current_component(‘activity’) )
Sorry, I missed the array() out of my example.
The slug of my page is actually “talk-of-the-town”, it is the static front-page of the site and has the buddypress activity page assigned to it. The page id is 95.
None of these tests identify the page, although they do identify the other pages in the list:
is_page(array('page1','page2','page3','talk-of-the-town')) ? get_template_part('filters') : get_sidebar();
is_page(array('page1','page2','page3','95')) ? get_template_part('filters') : get_sidebar();
is_page(array('page1','page2','page3','activity')) ? get_template_part('filters') : get_sidebar();
bp_is_page(‘activity’) does work.
I have the same problem with the groups page, btw.
The above is by way of information. The test is to load a special sidebar on certain pages, otherwise load the normal sidebar. I’m just going to reverse the test, to load the normal sidebar for other specified pages, otherwise load the special sidebar.
Thanks for your help…
here’s the code for bp_is_page. You can use
if ( !bp_is_user() && bp_is_current_component( ‘activity’) )
`function bp_is_page( $page = '' ) {
if ( !bp_is_user() && bp_is_current_component( $page ) )
return true;
if ( 'home' == $page )
return is_front_page();
return false;
}`
There is also bp_is_activity_component()