Jump to Sidebar Content | Jump to Main Page Content

Begin site navigation:
End site navigation.
Begin left menu:
Topics

Pages

 
Search
 
Links
 
Subscribe
 
End of left menu.
Begin main content:
Blog

WordPress’ current_page_item Selector Got You Down?

Thursday, February 7, 2008 5:36 pm

WP 2.6.x users, keep reading and see comments!!

On my last project, I came across an interesting bug in WordPress and thought an in-depth look into troubleshooting the problem might help others who encounter it….and maybe lead to it getting fixed once and for all.

The issue arises when using WordPress as a CMS in conjunction with navigation highlighting for menus. The problem is that WordPress doesn’t pass the current_page_item selector properly on the posts page, or to its associated category pages. There’s an easy fix which I have outlined below.

Let’s say you have a Web site with a static front page called ‘Home’ and a posts page called ‘Blog.’ You have created and assigned the appropriate custom templates for these pages, and you selected them in Options > Reading in WordPress’ administrative panel:

screen image

On this site, you also have a navigation bar in header.php that calls some variety of the wp_list_pages template tag. For example:


<div id="navlinks">
<ul>
<?php wp_list_pages('title_li='); ?>
</ul>
</div>

As stated in the wp_list_pages() codex, by default, WordPress generates a list of pages that are marked with the page_item class. When displaying a page, the list item for that page is given the additional current_page_item class. So, in this example, you have also assigned attributes to these CSS properties in style.css to distinguish the current_page_item when it is active:


#navlnks .page_item a:link, #navlnks .page_item a:visited, #navlnks .page_item a:active {
color: #FFFFFF;
}


#navlnks .current_page_item a:link, #navlnks .current_page_item a:visited, #navlnks .current_page_item a:active {
color: #000000;
}

This creates a default white link that changes to black when the current page is selected:

screen image

Let’s say you also have some pages with sub-navigation, or child pages. Here, again, you’re using the default current_page_item class for a different set of pages within a menu output by wp_list_pages(), for example:


<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<div id="sidebar">
<ul>
<?php echo $children; ?>
</ul>
</div>
<?php } ?>

For these child pages, you’ve also styled WordPress’ default current_page_parent selector to identify the associated current page in the top-level navigation. For example:


#navlnks .current_page_parent a:link, #navlnks .current_page_parent a:visited, #navlnks .current_page_parent a:active {
color: #000000;
}

When you’re on a page and you click into a child page, the top-level page indicator should remain so that you know you’re still within that same section of the Web site. For example:

screen image

This works just fine for pages, but not for pages with posts. On posts pages, the top-level active page indicator disappears:

screen image

In fact, for pages with posts, WordPress doesn’t pass the current_page_item class in the HTML at all:


<div id="navlnks">
<ul>
<li class="page_item page-item-1"><a href="http://www.umaitech.com" title="Home">Home</a></li>
<li class="page_item page-item-2"><a href="http://www.umaitech.com /about/" title="About">About</a></li>
<li class="page_item page-item-3"><a href="http://www.umaitech.com /portfolio/" title="Portfolio">Portfolio</a></li>
<li class="page_item page-item-4"><a href="http://www.umaitech.com /news/" title="News">News</a></li>
<li class="page_item page-item-5"><a href="http://www.umaitech.com /blog/" title="Blog">Blog</a></li>
</ul>
</div>

Interestingly, if you go back to Options > Reading and don’t select a posts page, it works. To replicate this, just leave the default – Select – option for the Posts page as shown here:

screen image

After doing this, WordPress properly outputs the current_page_item class in the HTML:


<div id="navlnks">
<ul>
<li class="page_item page-item-1"><a href="http://www.umaitech.com" title="Home">Home</a></li>
<li class="page_item page-item-2"><a href="http://www.umaitech.com /about/" title="About">About</a></li>
<li class="page_item page-item-3"><a href="http://www.umaitech.com /portfolio/" title="Portfolio">Portfolio</a></li>
<li class="page_item page-item-4"><a href="http://www.umaitech.com /news/" title="News">News</a></li>
<li class="page_item page-item-5 current_page_item"><a href="http://www.umaitech.com/blog/" title="Blog">Blog</a></li>
</ul>

At first I thought this would suffice as a workaround – it brings back the top-level selector:

screen image

But a big problem remains. When you click on an individual post or navigate into category pages, the current-cat class is properly identified, but the top-level selector disappears:

screen image

Therefore, it isn’t much of a workaround after all. After hours of head scratching and searching through the WordPress forums, I stumbled upon an unresolved discussion thread about this very same problem that was initiated 11 months ago. This directly led me to a solution – specifically, by using code posted by munzli.

If you’re experiencing this same problem and want to adapt the code, here’s what you need to do. This assumes you’re running WordPress version 2.3.2 or later and that you have properly selected your template pages in the Options > Reading panel as I discussed in the first example above:

1. Edit the wp-includes/classes.php file
2. ADD the following code as lines 520 and 521 (WP 2.5 users, add it as lines 563 and 564. WP 2.5.1 users, add it as lines 558 and 559. WP 2.6.x users, add it as lines 577 and 578):


elseif ($page->ID == $current_page || ($current_page == 0 && $page->ID == get_settings('page_for_posts')))
$css_class .= ' current_page_parent';

3. Save

The final result:

screen image

This solution ensures that the current_page_item selector is retained on top-level navigation for child pages, category pages, and single post pages — on both “regular” WordPress pages and “posts” pages. Until it’s incorporated as an actual bug fix, however, remember to re-add it anytime you upgrade WordPress.

Happy coding!

Comments are closed.

Comments

  1. Hi Betsy,

    Thanks for the post, I found it very interesting. We’ve started making more sites with WP as a CMS and found it very powerful. The main thing we’re struggling with is the mixing of posts and pages and I’ve not found much information about it.

    I’m still not quite grasping it though, perhaps you coule point me in the right direction? I’m using wp_list_pages to output my main menu and then in my sidebar I’m displaying the sub-pages for each main page. So far so good. Then for two of the sub-pages, I’m running them as blogs (well, one is a blog and one is a news-archive and call posts from two different categories). What I don’t understand is how I make WP realise that posts in a certain category, “belong” to a page, so that it keeps the menu (and highlighting).

    Above you talk about “pages with posts” – how does that work? I can set up category templates OK, which output whichever submenu I want to (then it loses the highlighting though, since WP doesn’t know “where” it is in the submenu), but this gets more complicated when looking at single posts, which is what you’re mentioning above.

    Maybe I’m partially misreading you and it’s not quite possible to say which category posts belong to which pages (or subpage), but if you have any hints, I’d appreciate it!

    Thanks,
    Karl

  2. Hi Karl, I’m glad you found the information useful. Regarding the posts and pages dilemma, you’ve come across another bug in WP’s menu highlighting. Currently, single posts are orphans – they aren’t assigned a “parent” page or category.

    The problem isn’t as noticeable if you’re mixing pages with one set of posts (your blog page), but it’s really obvious when you’re trying to divert some posts from your main blog off onto another page (e.g. news). Whether you’re using wp_list_pages or wp_list_categories to create that link in your navigation, the current_page_item (or current-cat) class appears fine for that page, but it disappears when you click into a single post.

    The issue is rather complicated. At first glance, one would think that WP just needs to spit out a “category-parent” class. But, what happens if the posts are assigned to multiple categories? My thought is that the solution requires some re-writing of WP’s classes.php file along with some crafty use of conditional tags in your single.php template.

    My line of thinking goes something like this: if is_single() and in_category(‘News’) then “assign this page or category as its parent and add a current class indicator.” I saw a possible upcoming fix in WordPress’ Trac (#2395). I’ve been testing out the proposed new classes.php code, but the CSS bloat I’m seeing is making my head spin (page_item page-item-21 current_page_item current_page_parent_l0 — that just can’t be right!). Haven’t yet seen the magic solution – if I do, I’ll definitely share.

  3. Hi Betsy and thanks for the additional info!

    Yep, it does seem a bit complicated and it would be nice if one could somehow link categories to a certain (sub)page. Considering WP’s history in blogging, I guess it hasn’t been as much of an issue earlier. It also seems people sometimes aren’t so concerned about showing where in the menu hierarchy their visitors are..

    It’s a bit of a head spinner, mainly because I lack enough PHP skill and don’t know the WP source code well enough, but at least I can get the menus and archives to display on the relevant pages with a combination of asking in_category and is_page queries, as you also mentioned above. So the navigation works, I just don’t have the relevant menus selected in any menus – main, sub or archive. If there is time at the end of the project for diving into the idea in the trac you listed. I have to wp_list_pages (main and sub) and a get_posts call for the archive, so it’d have to be a varied approach. Oof!

    Thanks again for sharing your insights, hopefully in later versions of WP this will get more attention.

  4. Hi, thanks for this post! I have one little problem… I named my posts page as “News”. I did as you said by selecting the front page as “Home” and the Posts page as “-Select”. The menu issue gets solved but the NEWS page does not display the posts anymore. It only displays the page title.

    Do you know what may be causing that? Thanks!

  5. Hi Raphael,

    Sorry for the late response. If you choose the first workaround and leave -Select- as the default, then there’s an easy fix to your problem. In the file you’re using as your News template (i.e. news.php), add this template tag at the beginning of your WordPress mini loop:

    <?php query_posts(‘all’); ?>

    However, if you continue on to workaround #2 and modify the classes.php file as described above, you’ll want to change your static page option from -Select- to your custom template (i.e. News). Then, you won’t need the query_posts tag in your template.

    Essentially, you can do either fix depending on your comfort level and what you’re trying to achieve.

    BTW, nice work!

  6. [...] gleiche Problem hatte, und eventuell sogar eine Lösung bereitstellt. In diesem Fall Umai, der in diesem Eintrag beschreibt, wie sich das Problem lösen [...]

  7. Hi,
    thanks a lot for your post. Helped me out with a site I currently build.
    Andreas

  8. Hi,

    thank you very much for your description!
    Works like a charm and saved me hours of desperate caffeine induced hacking.

    Manuel

  9. Hello,

    Thank you for this information. I too had a page that I labeled news. Could not figure out why it would not highlight. After reading this post and the comments after. I got it working just perfect. Thank you again!!

  10. Thanks Betsy so much for this. Been looking everywhere for solution to this problem. One more question. Is workaround #2 ready for WP 2.5? I opened up classes.php in 2.5 and got lost in lines 520 – 521. Any idea where to add that code in 2.5?

    Thanks again,
    David

  11. Upgraded to WP2.5 and the issue is still there. The classes.php file has changed though so the fixed described in the post does work since lines 520-521 have changed. Has anyone found a fix for WP2.5 yet?

  12. Sorry, I was wrong in my previous post. The ‘current_page_parent’ works for pages in WP2.5. The problem I am having is that if a ‘posts page’ is selected then that page is not given the proper CSS class when you are on a post. For my example, I have a page called blog and it does not highlight when I am on any posts. Any thoughts?

  13. Ok sorry for all the posts but I felt Betsy’s post here was quite helpful so I wanted to share what I have found out. Basically if you and the following two lines after line 562 in classes.php it will fix the problem I was having in WP2.5:

    elseif ($page->ID == get_settings(‘page_for_posts’))
    $css_class .= ‘ current_page_parent’;

  14. Thanks Josh – You headed me in right direction. I plugged in Betsy’s code after line 562 in classes.php and it worked like a charm!

  15. You guys rock! Thanks for sharing your findings with me. Yes, the current_page_item problem (#2959) has been fixed in WP2.5. However, the second issue remains: retaining the current_page_parent class after clicking into categories and individual pages.

    The new classes.php file is a little different. It uses PHP’s empty function and declares “if not empty.” But this issue entails “empty orphans.” The fix addresses that and can be used if you place it AFTER line 562. Josh’s fix also works. Or, you can declare a separate if statement with the empty function for consistency:

    New lines 563-566:


    if ( empty($current_page) ) {
    if ($page->ID == get_settings('page_for_posts'))
    $css_class .= ' current_page_parent';
    }

    Since we’re still assigning the class to all empty orphans, I’d only recommend doing this for sites that have one page with posts (i.e. Home, About, Portfolio, Blog) — not ones with multiple pages with posts as Karl and I discussed in comments 1 & 2 above. Still haven’t figured that one out yet…

  16. Hey, just wanted to let those of you who are following this thread know that I significantly updated my previous comment.

  17. Hi,
    I tried this, and for some reanson it didn’t work.

    But it’s ok, cause someone did a plugin for this which worked for me :p

    here’s the link http://thomas.lippert.it/v4/wordpress-plugins/current-page-bugfix/

    Anyway, thanks for sharing you work Betsy.

  18. Hi Sam,

    Try copying and pasting the code again. For WP 2.5, make sure you place it after the closing bracket of line 562…so the code begins on line 563.

    This is a simple, solid fix. The plugin requires use of a custom template tag instead of wp_list_pages(). That can be problematic for existing themes, and for theme developers.

    Good luck!

  19. Thank you Betsy!!! After searching around for a bit I came across your solution and it worked perfectly first try! :)

  20. Ok – looks like the classes.php file has changed a little in WP 2.5.1, however the ‘current page bug’ remains. It looks like the code now needs to be placed on line 559 to work.

  21. I had a after the 2.5.1 upgrade.
    Had it all working before that!

    The problem was in the Write > Posts page and selecting Categories.
    The categories list would not show available categories.
    I restored to the original classes.php file and the categories returned in the post page.

    My problem is I need both functionalities!
    Want to select categories, and also keep my current_page_item Selector.
    Any clues?

  22. Hi Betsy

    Thanks for your informative page! I *think* your information can fix my problem, but I’m so new to all this, and have been playing (and learning) with the code a lot!

    Basically, when I select a link in my new navbar, it goes to that page, but the navbar disappears.

    So, as per your suggestion, in ‘reading’ I want to select ‘a static page’. But it doesn’t give me ‘home’ as an option, just all the other pages. How do I make a link to my ‘home’ page? Or should I? Can you help me at all? Sorry if this is not related to your page here, but I think it is… thanks!

  23. Hey everyone. Sorry I haven’t been timely in posting back to some of the questions here.

    Paul, are the category listings disappearing in the admin panel or on your public site?

    Brenda, to create a static front page you first need to create a custom template so that it is selectable from the admin panel. Remember to name it:

    <?php
    /*
    Template Name: Home
    */
    ?>

  24. Per instructions by “Creative World” I pasted the code in WP 2.5.1 in classes.php on line 559 and it did not fix it. Could you please provide line numbers and a description of between “this” and “that” so I can search for those pieces of code and know I’m putting it in the right place?

    Thanks!

  25. Didn’t intend to neglect my WordPress friends! I may be confusing everyone because there are two solutions being discussed here. Both options work, but only choose one.

    For WP 2.5.1, the original code from the top of this page should be added as lines 558 and 559. In that instance, you’re appending the existing “not empty” statement, so add the code BEFORE the closing bracket (which moves to line 560).

    However, I prefer using a new “if empty” statement. In this instance, you want to add these 4 lines of code AFTER the closing bracket (which stays at line 558).

    New lines 559-562:

    if ( empty($current_page) ) {
    if ($page->ID == get_settings('page_for_posts'))
    $css_class .= ' current_page_parent';
    }

    If anyone has any trouble or questions, please post back here or e-mail me directly. Feel free to connect with me on Facebook as well.

    Happy coding!

  26. Thanks for this code, I am just about to try it out. You definitely fixed a common problem.

    I’ve got another one for you if you’re clever :)

    For my main menu of WordPress pages, I would like to put a different background image for each page link when it is the current active page. For example, when on the “About Us” page I want a star background image for the active About Us link in the menu. When on the “Blog” page, I want a newspaper background image for the active Blog link in the menu.

    I can do this manually, of course, but it would be nice to figure out a way to automate it in WordPress.

    Thanks again for your contribution.

  27. Thank you SO much for this, you have just saved me from going insane!

  28. P.S. For WordPress 2.6 the code needs to be inserted after the closing curly brace on line 576

  29. Thanks Simon! Yes, you are correct…after line 576 as new lines 577-580. Cheers!

  30. Nice article. thanks

  31. A really really really really
    BIG BIG BIG THANKS!!
    Thank you soo much!
    I was going to kill myself because of this problem
    but I found the solution here. You saved my life!

  32. Life saving solution! Thanks! Indeed, the solution from comment 25 did the trick for me.

  33. This bug has been killing me I found a really really ugly workaround that didn’t validate so I didn’t want to use it, but this is great. Thanks so much.

  34. Hi Betsy,

    Just a quick note to say thanks for the post. We’ve had this as an issue for the last week. After a day wasted we moved onto other stuffs, now with the site ready for launch, I’ve spent the day trying to hack the nav. We have some custom jazz in our main nav so we spent most of the time blindly blaming our code and didn’t even google the problem. School-boy-error, anyway all sorted now – chuffed.

    Thanks again.

    Rob

  35. Don’t change the WP core. It’s not the proper way. Use jQuery insted.

    <script type=”text/javascript” src=”/jQuery.js”>

    PHP: post_type != ‘page’) : ?>

    jQuery(document).ready(function() {
    $(“li”)
    .filter(“.page-item-2″).attr(‘class’, ‘current_page_item’)
    .end()
    });

  36. I hope this time you’ll se all the code :)

    <script type=”text/javascript” src=”/jQuery.js”>

    post_type != ‘page’) : ?>

    jQuery(document).ready(function() {
    $(“li”)
    .filter(“.page-item-2″).attr(‘class’, ‘current_page_item’)
    .end()
    });

  37. Darn …

  38. Hi Miha,

    In this particular case, changing the WP core *is* the proper way to fix the problem. It’s a known bug and it has been entered (a couple of times) into Trac. At some point, it’ll be rolled into a WP update. Until then, the solution I have presented here resolves the problem. Cheers!

  39. Hi,
    can someone PLEASE post a short FILE or liek

    PUT this [CODE] into file …. readign this site here is very confusing.

    What i did is, added the lines of code from the above comments to the classes.php … which changes absolutly nothing.

    Bump

    Ty

  40. Hi Ty,

    For WP 2.6.2, add this code in wp-includes/classes.php:

    New lines 577-580:

    if ( empty($current_page) ) {
    if ($page->ID == get_settings(‘page_for_posts’))
    $css_class .= ‘ current_page_parent’;
    }

    Or download this copy of classes.php which contains the bug fix and overwrite your copy in wp-includes/classes.php. Good luck.

  41. Brilliant solution. Many thanks for this information. It solved what for me was the unsolvable.

  42. Grrr… the classes.php file seems to have changed in 2.6.3. When I add those lines the page then fails to load (blank white page). Any thoughts? Does it break again in 2.6.5?

    Thanks for the development you’ve put into this. You’d think that WP would pick it up already…

    Dan

  43. For those using 2.6.2 this works exactly as described. The problem with this solution is that it immediatly assumes the user will only be posting within one category, say “News” for example. The code checks to see if “News” is the default and then uses that information to set highlighting. Unfortunatly I have too many options for the user to post within and each post is subdivided within mulitple categories making this even worse.

    Is there another fix for this issue? Or perhaps a way to check $post->ID and post category of the current post displayed to determine which navigational item should be highlighted?

    Thanks

  44. Because this site was the most helpful in starting a solution for this issue I’m posting a solution for those with multiple “Posts Page” defaults, those of us who cannot select just one “Posts Page”. This is typical for anyone using WP as a CMS.

    First let me say thank you to Betsy for offering the only workable solution that I found, even though it wasn’t exactly what I was looking for, it gave me hope. For those using WP as a CMS with multiple “Post Pages” needed to be selected in the Settings > Reading panel here is the solution I derived.

    In you header.php just above the “head” tag insert something to the effect of:

    if(is_single() && in_category(3)) {
    echo ‘

    #nav-global ul li.page-item-221 a {
    color: #9F9D8B;}
    ‘;
    }

    Now when in category 3 the code will display and affect a class of “page-item-221″. “page-item-221″ is the assigned $page->ID number and the code typically allotted by wp_list_pages. This code is something like: class=”page-item page-item-3″ which should be followed by “current-page-item” and as we all know is not working when in a single.php file.

    It will more than likely be necessary to add quite a few of these styles to get the desired effect, so in this case it’s nice to use an additional include php file.

    Remember this is used only when not setting anything for “Front Page” or “Posts Page” under Settings > Reading.

    Thanks again.

  45. Hi Doc4,

    Thanks for the great follow-up to comment #2 above. Assigning WP classes for multiple categories is an ongoing personalization challenge because everyone’s categories are different. You have posted a good option here that people can customize to suit their needs.

  46. Hi everyone! Just a quick update…

    Here’s a new classes.php file for v.2.6.5. After downloading, just rename it to classes.php and place it in your wp-includes directory. Also, I’m very, very pleased to announce that this bug fix has been rolled into WP 2.7 (#7518). You can download RC Candidate 1 now or wait for the official release.

    Finally, many thanks to each of you for the kind words! Peace to you and yours.

  47. If you upgrade to WordPress 2.7 (I just installed RC1) WP now adds the class “current_page_parent” to your navigation so you can target it with CSS. Here’s a sample of the code I used in my CSS:

    /* Main Menu – Current Page Item Even if Child Page */

    #menu ul li.current_page_parent {
    line-height: 35px;
    }

    #menu ul li.current_page_parent a {
    background: url(images/menu_button.gif) no-repeat right top;
    margin-top: 0;
    color: #1A272E;
    border: 0;
    }

    #menu ul li.current_page_parent a:hover {
    color: #1A272E;
    }

    #menu ul li.current_page_parent a span {
    background: url(images/menu_button.gif) no-repeat left top;
    height: 35px;
    }

    I’m using sliding doors FYI.

  48. Betsy the new classes php file for 2.65 appears to be empty? Is it available somewhere else or can you put the code change here in the comments? Thanks so much for solving this riddle.

  49. Oh I see you have it included for 2.6x in the post above. will try that

  50. Sorry about that. Let’s try this file: classes.php. It’s an inc file. After downloading, rename it to classes.php and place in your wp-includes directory.

  51. Any idea on where this would go in the file for wp 2.7?

    It’s astonishing to me that through all these version modifications, there hasn’t been someone checking into this. Have you considered reporting this bug to WP?

    Thanks for the awesome insight. I truly appreciate it!

  52. Hi Betsy,

    Thanks very much, worked like a dream :-) I’m using WP 2.6.2 so added the code as described but not looking to upgrade just yet as finally have the site set up as needed and don’t need the new version just yet!

    I’m using WP as a CMS and have one problem still. While relevant section (‘Blog’) is now highlighted for posts, the URL has not changed nor my breadcrumb trail (I’m using the plug-in Yoast Breadcrumbs).

    So instead of http://www.domainname.co.uk/blog/2008/12/ I get http://www.domainname.co.uk/2008/12/ or instead of http://www.domainname.co.uk/blog/category/sport/ I get http://www.domainname.co.uk/category/sport/

    My permalinks are set-up as /%category%/%postname%/
    which works fine for all pages but do I need to change for the posts to work to?

    Great post, thanks for the advice :-)

    Regards,

    Adrian

  53. Hi Erika,

    The good news is that the bug fix has been rolled into WP 2.7! It took awhile, but this problem is now resolved. Yeah, I’m even there in the official props list. Woo-hoo!

    So, if you upgrade to WP 2.7, you no longer need to edit the classes.php file and this post is entirely irrelevant to you. But if you are waiting awhile to upgrade, the info here is still useful to you until you do upgrade.

  54. Hi, Betsy;

    I just upgraded to 2.7 but…
    - I’ve set Settings > Reading to “Latest News” but the URL is missing a backslash which results in an invalid URL
    - when I use in header.php, the category-specific tab is still not highlighted

    Is there a working solution in 2.7 that I can find somewhere?

  55. Okay, so code tag doesn’t work. Let’s try this in plain text.
    <ul class=”tabs”>
    <?php wp_list_pages(‘title_li=’); ?>
    </ul>

  56. Betsy, I found some hope in your solution here…and was happy to see this fixed in 2.7. However, for me it isn’t fixed, and it may be a wp theme issue. the theme I’m using lists parents only in the header bar. I’ve got 5 subpages under a parent page, and when I’m on a subpage, the parent page is not highlighted.

    I’m running the latest wp 2.7. Any ideas on where I could start to fix this?

    Thanks,

    Sam

  57. Hey everyone. It looks like there are lot of people having trouble getting this to work in WP 2.7. This was a WP bug since inception, so it never worked properly before version 2.7. Therefore, many themes (including the default WP theme) are missing the .current_page_parent class.

    If you have access to your theme’s stylesheet — usually the default style.css — you can add it yourself. If you’re a WP user, go to Appearance > Editor and click on Stylesheet (style.css). Feel free to use these sample class definitions as a starting point:

    #navlnks .current_page_parent a:link, #navlnks .current_page_parent a:visited, #navlnks .current_page_parent a:active {
    color: #000000;
    }

    Happy New Year!

  58. Hi,

    I am using wordpress 2.7 and i have the same issue that selecting post pages of parent page, the parent link is no more highlighted. Can you please on which line of classes.php I should alter to solve this problem.

    Your help will be greatly appreciated.

    Thanks
    ishafaat
    http://tinyurl.com/8xrdwo

  59. Hi Betsy,

    After wading through all of the above, it’s clear this issue is emphatically *not* resolved for wp 2.7. To be fair to wordpress, this is probably a theme issue, as menu generation is frequently taken over by the theme.

    Here’s my example. I use only a single (left) navigaion menu, with nesting of pages. All my menu items are pages, except for “News”, which is a post. “News” is nested under “News and events”. If you click your way to “News”, the menu closes up, displaying only the parent (“News and events”) and hiding the menu item for the page you are looking at (“News”).

    The solution undoubtedly involves a multi-way interaction between classes.php, my theme (atahualpa3) and multiple style sheets. That is, it is diabolical. I’ll post the solution when I find one…

  60. Nice one, it worked. Was searching for some time for this one.

  61. Hi Betsy

    Any idea on where in the classes.php the lines must be inserted.

    Best
    Jan


End of main content.