At my wit\'s end with custom theming …
-
I need some help guys and gals …
I am designing a custom theme, completely from scratch, for an install of WPMU, including BuddyPress. I’m running WPMU 2.8.4 right now and BP 1.1.1. What I’m trying to do doesn’t seem like it would be that hard. I’m just obviously not understanding the whole scope of what I need to know.
I basically need to load specific information into header/footer/content areas of various pages (including, but not limited to archives, 404’s, single posts, pages, buddypress pages like profile, activity, etc). My strategy has been to create custom header and footer files for each necessary case, then use an if … elseif … else statement in the main header.php/footer.php files to include the appropriate content.
While I seem to be able to get this work in many different occasions, blending the buddypress pages with the WPMU pages (particularly search, archive, and 404) has proven difficult. Apparently, BuddyPress pages like Profile, Activity, etc return true to the following WP Conditionals placed in my header.php – is_archive(), is_search(), and even is_404() if you can believe that.
I know this is dragging on, but please stick with me if you can, because I am highly frustrated. To make matters more confusing, once we have included the header, in this case headerHome.php, I then run an if … elseif … else statement to determine which of the main menu tabs should be set to active, and it always shows correctly.
I am totally befuddled by this. It seems that the two statements, which are essentially identical except for what info they return, should display the right content. Here are the two code examples:
From header.php
<?php
if ( is_home() ) {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php');
} elseif ( is_single() ) {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php');
} elseif ( is_page(array ('Why We\'re Here', 'ahecs') ) ) {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php');
} elseif ( is_archive ) {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php');
} elseif ( is_search ) {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php');
} elseif ( is_404 ) {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/homeHeader.php');
} else {
include (TEMPLATEPATH . '/../ARHealthCareersFrameTheme/customHeaders/communityHeader.php');
}
?>From this code, all BuddyPress pages display the homeHeader.php file. Curiously, however, if I remove the is_archive, is_search, and is_404 lines, communityHeader.php loads correctly.
Here is the bit of code from homeHeader.php
<?php
if ( is_home() )
$mainMenuTab=0;
elseif ( is_single() )
$mainMenuTab=0;
elseif ( is_archive() )
$mainMenuTab=0;
elseif ( is_page(array ('Why We're Here', 'ahecs')) )
$mainMenuTab=0;
elseif ( is_search() )
$mainMenuTab=0;
elseif ( is_404() )
$mainMenuTab=0;
else
$mainMenuTab=2;
?>So, with my original header.php file, all BuddyPress pages show homeHeader.php instead of communityHeader.php. However, the variable $mainMenuTab will be set to 2, which means the code atop homeHeader.php is performing as I would expect, but not the code inside the header.php file.
Anyway, I know this is a lot to weed through, but I would greatly appreciate any thoughts you all might have as to why I am banging my head against the wall on this one. Things would be easier if the BuddyPress conditionals would perform as expected, but I have had no luck with the conditionals like bp_is_user_profile and others.
Am I just going about this task in the wrong way? Do I not really have a sound understanding of how to accomplish this particular task? Or is something just screwy?
Please help if you can.
- The topic ‘At my wit\'s end with custom theming …’ is closed to new replies.