Conditional Tag Questions (specifically bp_is_user_profile)
-
Basically, I am needing to find a way to include one header/footer combination for all buddypress pages across my site, while dispalying another header/footer combination on other WPMU pages not related to the social networking functionality of BP.
After getting some help from these forums, I thought I could just stick some if…elseif….else code in header.php that would do the following:
if (PAGE IS BUDDYPRESS RELATED) include header-buddypress.php;
elseif (PAGE IS ABOUT PAGE) include header-about.php;
else include header-home.phpI figured I could do the same with the footers. It seemed on the face of it that this should be fairly simple using conditional tags, but they aren’t functioning as I expected.
For example, this code in my header.php file
<?php if ( bp_is_user_profile() ) {
get_header(bpProfile); //include bpProfile header if page is a bp profile page
} elseif ( is_page('Why We're Here') ) {
get_header(about); //include about header if page is not a profile page
} else {
get_header(home); //include normal home header in all other cases
} ?>always produces the bpProfile header. If I echo bp_is_user_profile, it always comes back as “1,” no matter what page I’m on with WPMU, whether I’m logged in or not.
I am kind of befuddled at this point. Perhaps I’m going about this the wrong way, but I just figured this would be the best way to modify a child theme to my specifications by just having a few custom header/footer files that are included as needed each time a page calls get_header(); and get_footer();
Does anyone have any thoughts on this?
- The topic ‘Conditional Tag Questions (specifically bp_is_user_profile)’ is closed to new replies.