Skip to:
Content
Pages
Categories
Search
Top
Bottom

is_page() cannot identify a page that has buddypress activity assigned to it


  • terraling
    Participant

    @terraling

    Hi,

    I have a static front page with slug of, say, site-stream, and I have the buddypress activity page assigned to that same page.

    That assignment for some reason stops the is_page(‘page-1’, ‘page-2’, ‘site-stream’) test from working (it recognises page-1 and page-2 no problem, but not ‘site-stream’. The problem persists even if I replace ‘site-stream’ with the correct page ID.)

    The issue is resolved if I uninstall buddypress, it recognises either the slug or ID.

    What term/slug should I be searching on for is_page() to recognise the page when I have the buddypress activity page assigned to it? (Not ‘activity’, I tried that.)

    I’m using WP 3.5.1 and BP 1.7.

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)

  • modemlooper
    Moderator

    @modemlooper

    bp_is_page(‘activity’)


    terraling
    Participant

    @terraling

    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…


    terraling
    Participant

    @terraling

    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?


    terraling
    Participant

    @terraling

    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’) )


    terraling
    Participant

    @terraling

    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…


    modemlooper
    Moderator

    @modemlooper

    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;
       }`

    modemlooper
    Moderator

    @modemlooper

    There is also bp_is_activity_component()

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘is_page() cannot identify a page that has buddypress activity assigned to it’ is closed to new replies.
Skip to toolbar