Highlight Current Page in menu not working on “posts” page
-
Hello. My name is Derek and I have been struggling for hours with this problem. Anyone that can help I greatly appreciate it.
I want the current page in my navigation to be highlighted. It works for all pages except my “posts” page, which is my blog page. Here is the code I am using in my header template: (I have also used plugins which I talk about below the code.
<div id="mainnav"> <ul id="mainnav"> <li<?php if (is_home()) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>">Home</a> </li> <li<?php if (is_page('about')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/about">About</a> </li> <li<?php if (is_page('lessons')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/lessons">Lesson Pricing</a> </li> <li<?php if (is_page('student-gallery')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/student-gallery">Student Gallery</a> </li> <li<?php if (is_page('blog')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/blog">Blog</a> </li> <li<?php if (is_page('contact')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/contact">Contact</a> </li> </ul></div>
It works fine for every page except the blog page which is my “posts page.” I have tried using the plugins Menu Maker and WP Menu Manager and get the exact same result. The problem I am having is when you navigate to the the blog page (where the posts are) it isn’t getting recognized as a “current page.” I have checked this with Firebug. FYI, I am not having problems with the CSS, as every page but my blog page (posts page) is highlighted when current.
I also have a similar problem with breadcrumbs. Everything comes up on the breadcrumbs except the blog page, which is the posts page. When I navigate to the blog page, the breadcrumbs indicate I am on the home page.
I am absolutely stumped. Again, your help is greatly appreciated.
- The topic ‘Highlight Current Page in menu not working on “posts” page’ is closed to new replies.