Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity Page condition?


  • Beardy
    Participant

    @ryanbeardy

    Hi

    The activity page seems to be set up unusual way (for me) in that there is no “page ID” for it in the same way as I can find when going to Pages or Posts.

    I am trying to load some script on my Activity page but none of these seem to work to verify its the Activity page

    if ( is_page( 'activity' ) ) {
        echo "This is the activity page!";
    } else {
        echo "This is not the 'activity' page.";
    }
    if ( bp_is_activity_component() {
        echo "This is the activity page!";
    } else {
        echo "This is not the 'activity' page.";
    }
    if ( is_page( 222 ) ) {
        echo "This is the activity page!";
    } else {
        echo "This is not the 'activity' page.";
    }

    Is there a way to identify the Activity page?

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

  • Youzify
    Participant

    @kainelabsteam

    Since version 12, BuddyPress has no longer used WordPress pages. That’s why you will not find a page ID on the BP pages.

    A possible solution, you install the BP Classic plugin so the BuddyPress page can use the WP page.


    Upen Singh
    Participant

    @upenwp12

    // Check if the current component is 'activity'
    if ( bp_is_current_component( 'activity' ) ) {
        echo "This is the BuddyPress activity page!";
    } else {
        echo "This is not the BuddyPress activity page.";
    }

    bp_is_current_component( ‘activity’ )
    This function checks if the current BuddyPress component being viewed is ‘activity’. Since BuddyPress 12 doesn’t use WordPress pages for components like activity, this is the correct way to detect if you are on the activity section.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar