Skip to:
Content
Pages
Categories
Search
Top
Bottom

Conditional Tag Questions (specifically bp_is_user_profile)

Viewing 2 replies - 1 through 2 (of 2 total)
  • @toddlevy

    Participant

    for bp_is_user_profile(), you can use this…

    <?php

    global $bp;

    if($bp->current_component == BP_XPROFILE_SLUG) {

    //Your code here

    }

    ?>

    Found this tip here… https://buddypress.org/forums/topic/show-specific-content-on-profile-page-only#post-26739

    @madyogi

    Participant

    Okay, so I followed your advice, toddlevy, but for whatever reason, I’m still getting my profile header the home page. The following is in my header.php file:

    <?php

    global $bp;

    if ($bp->current_component == BP_XPROFILE_SLUG) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/communityHeaderTest.php'); //include this header on BuddyPress profile pages
    } elseif ( is_home() ) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php'); //include this header on home page
    } elseif ( is_single() ) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php'); //include this header on posts
    } elseif ( is_page('Why We're Here') ) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php'); //include this header on about page
    } else {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/communityHeader.php'); //include this header on BuddyPress pages
    } ?>

    Any ideas as to why this would include communityHeaderTest.php on the home and about pages? Single pages are including the correct header.

    I have been working with this code in my header, which seems to work for what I need:

    <?php

    if ( is_home() ) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php'); //include this header on home page
    } elseif ( is_single() ) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php'); //include this header on posts
    } elseif ( is_page('Why We're Here') ) {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php'); //include this header on about page
    } else {
    include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/communityHeader.php'); //include this header on BuddyPress pages
    } ?>

    Still, it seems like I should just be able to use the BP conditionals to find out which specific BP page I’m on and display content accordingly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional Tag Questions (specifically bp_is_user_profile)’ is closed to new replies.
Skip to toolbar