Skip to:
Content
Pages
Categories
Search
Top
Bottom

Target only profile page


  • nkeatign
    Participant

    @nkeatign

    How can I either write a function, or create a custom template that is only used for the users main profile page?

    The way buddpress works by default, all of the various profile sub-pages seem to use the same exact template.

    For example, I want to specifically target domain.com/username (which we have as the main profile page).

    Do NOT want to target, domain.com/usersname/friends, domain.com/username/followers, domain.com/username/activity etc.

    I need to add some custom data to only the main profile page, and not have it trickle down to the subpages…

Viewing 1 replies (of 1 total)

  • Henry Wright
    Moderator

    @henrywright

    What are you using for your default landing tab?

    As an example, let’s say you’re using activity (which is the default tab anyway) so no need to do the following:

    define( 'BP_DEFAULT_COMPONENT', 'activity' );

    Now, your example.com/members/username screen can be targeted like this:

    if ( bp_is_user_activity() ) {
        // Do something.
    }

    Note: bp_is_user_activity() will also target activity sub-screens so if you want to exclude these you’ll need to modify your condition slightly.

Viewing 1 replies (of 1 total)
  • The topic ‘Target only profile page’ is closed to new replies.
Skip to toolbar