Wrong Navigation Button Highlighted and Wrong Page Title
-
I use WPMU v2.7.2 and BuddyPress v1.0.1, I created a couple new pages using the Add New Page feature in the WordPress Dashboard. Then I edited the Navigation bar source using Dreamweaver so that their buttons will appear in the Navigation bar. They appear and work perfect, but when on the new page the Members button is highlighted instead of their respective button. I can’t figure out how to get it so that their respective button will be the one highlighted. Also, the page title in the top left of the browser window show the name as “Blog” for all of my new pages, instead of the actual name of the page. Does anyone know how to fix any of the above problems I am facing. Thanks much in advance.
-
Word of advice: Do not use Dreamweaver to edit PHP code!
Dreamweaver could have mangled the original BP template code.
Could this have caused the Members button to be highlighted instead of the correct button. For the title of the page being Blog, I thinks its because BuddyPress treats newly created pages as a page within you Blog instead of being just an independent page. Is there any way to change the title of a page? Or to fix the wrong button being selected in the navigation.
Does anyone know how to fix this, I am having a lot of trouble.
Hey sorry for not replying.
What did you do here?
Then I edited the Navigation bar source using Dreamweaver so that their buttons will appear in the Navigation bar.
Re-trace your steps, what files did you edit?
Let us know.
What i did was go into the header.php file for the bp-home theme, and edited what was within the <ul id=”header”> tag. For example, this is what I have for the Games page I created through the Dashboard:
<li<?php if ( bp_is_page( games ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo games ?>" title="<?php _e( 'Games', 'buddypress' ) ?>"><?php _e( 'Games', 'buddypress' ) ?></a></li>
. The only differences are those I felt were relative to the new page.such as where it says bp_is_page, I put games into the perenthesis instead of what was there before.Try this:
<li<?php if ( is_page('games') ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/games" title="Games">Games</a></li>
I removed bp_is_page() and replaced it with is_page(), since bp_is_page() is only specific to BP components.
Also I removed the _e and echo references to “Games”. Chances are you won’t be using a translation patch editor.
The correct navigation button is now selected, but the Members button is also selected, and page title in the top left of the window is still ConnorGrady.com – Blog, instead of ConnorGrady.com – Games. Thanks though for getting me this far!
Can you post your full <ul id=”header”>?
I have a feeling something is messing up there.
—
Actually you know what?
Use the default header from the original bpmember theme… and see if you get any weird bugs.
<ul id="header">
<li<?php if ( bp_is_page( 'home' ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a></li>
<li<?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php bp_home_blog_url() ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li>
<li<?php if ( bp_is_page( BP_MEMBERS_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo BP_MEMBERS_SLUG ?>" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a></li>
<?php if ( function_exists( 'groups_install' ) ) { ?>
<li<?php if ( bp_is_page( BP_GROUPS_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo BP_GROUPS_SLUG ?>" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a></li>
<?php } ?>
<?php if ( function_exists( 'bp_blogs_install' ) ) { ?>
<li<?php if ( bp_is_page( BP_BLOGS_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo BP_BLOGS_SLUG ?>" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a></li>
<?php } ?>
<?php do_action( 'bp_nav_items' ); ?>
</ul>InactiveI’m having the exactly same problem. I’ve added several menu items linking to pages and they work fine, but when ever I view them the Members menu item is always highlighted along with the one for the page being viewed.
I’ve checked though the header and I’m baffled. If I use the default header form the bphome theme I don’t notice any problems (but obviously I don’t have my extra menu items).
Anyone got any thoughts?
Cheers
Simon
I’m having the same issue as described above in that when I add pages to the blog that buddypress is active on they are being highlighted as member pages in the navigation bar, even though according to the is_page rules the member page should only highlight when the BP_MEMBER_SLUG is identified. For some reason all .com/######/ are being highlighted as member pages (well those that are not main blog, groups or blogs anyway …
I will try and mess around with the bp_is_page vs is_page as r-a-y suggests. I also use dreamweaver for editing code but have never rewrite code on phph enabled so can’t see that as being the issue.
I was able to fix the problem by just making some simple changes to the PHP in the header. I changed the following:
<li<?php if ( bp_is_page( sports_news ) ) {?> class="selected"<?php } ?>><a>/<?php echo sports_news ?>" title="<?php _e( 'Sports', 'buddypress' ) ?>"><?php _e( 'Sports', 'buddypress' ) ?></a>
To:
<li<?php if ( is_page('news') ) {?> class="selected"<?php } ?>><a>/news" title="News">News</a>
This fixes the entire problem, and now the respective button is highlighted. I am changing this topic to “resolved”.
- The topic ‘Wrong Navigation Button Highlighted and Wrong Page Title’ is closed to new replies.