WPMU and BP trunk versions. Using custom child theme of 1.2 bp-default.
WPMU for this project is used as CMS and BP is installed in blog_id_1
My sitewide main navigation is from blog_id_1 and generated from wp_list_pages. I've added BP items in a subnav enclosed in following conditional tag to appear only in BP-generated pages in main site, like so:
<?php if (is_home() || is_page('12') || || is_page('16') || is_page('25') || is_page('29') ) { } else { ?>
<div id="subnavz">
<ul id="nav2">
<li<?php if ( is_page( '151' ) ) : ?> class="selected"<?php endif; ?>><a href="http://mysite.com/member/" title="<?php _e( 'Clubhouse', 'buddypress' ) ?>"><?php _e( 'Clubhouse', 'buddypress' ) ?></a></li>
<li<?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) || bp_is_blog_page() && !is_front_page() ) : ?> class="selected"<?php endif; ?>><a href="<?php echo site_url() ?>/<?php echo BP_HOME_BLOG_SLUG ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li>
<li>etc </li>
<li>etc </li>
<li>etc </li>
<?php endif; ?>
<?php do_action( 'bp_nav_items' ); ?>
</ul>
</div><!-- subnavz end-->
<?php } ?>
#1: The code above is working to a certain extent (see #2 below). But I need a more elegant solution to above because I'll be adding much more Pages in main site and I foresee the major task of adding each Page (is_page('etc') ) to exclude above :-)
I've been looking for the conditional tag to include ALL BP items, just can't find it or overlooking something, so that I can just code something like
<?php if (is_BP_Generated_Pages_Only) : ?>
<div id="subnavz">
<ul id="nav2">
<li<?php if ( is_page( '151' ) ) : ?> class="selected"<?php endif; ?>><a href="http://mysite.com/member/" title="<?php _e( 'Clubhouse', 'buddypress' ) ?>"><?php _e( 'Clubhouse', 'buddypress' ) ?></a></li>
<li<?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) || bp_is_blog_page() && !is_front_page() ) : ?> class="selected"<?php endif; ?>><a href="<?php echo site_url() ?>/<?php echo BP_HOME_BLOG_SLUG ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li>
<li>etc </li>
<li>etc </li>
<li>etc </li>
<?php endif; ?>
<?php do_action( 'bp_nav_items' ); ?>
</ul>
</div><!-- subnavz end-->
<?php endif; ?>
so that subnavz will show only when in the BP-generated-page.
#2. Re first code I posted above. The code shows correct "selected" class in WPMU sites except when with BP-enabled WPMU site like this one...
a. I am in the first subnavz link, "Clubhouse" (page_151), the "selected" class is applied for both "Clubhouse" and "Blog" (the second link) - BAD
Note: Clubhouse (page_151) is a page-template with code for sitewide Activities and I have it in the main navigation as well with same slug (member) but different page title "Members" (page_151 also)
i.e. http://mysite.com/member/ = "Members" link in main navigation and "Clubhouse" link in sub-navigation.
When someone clicks on the Members(page_151) link in main navigation, it opens the subnavigation with Clubhouse(page_151) in first link.
b. When I click on "Blog" link, the subnavz disappears (BAD!) but when I click on the blog's post permalink, I get the subnavz back with "Blog" link has "selected" class (GOOD).
I've been looking at this for the past few hours and I need new set of eyes to see what's making this stumble in BP-enabled site :-)
Thanks.
P.S. I've tried removing is_frontpage from second link code, "Blog" but still the #2a and #2b behaviors persist.