[How-To] – Menu: Highlight Current Page.
-
Hi there!
I’ve spent a lot of time trying to figure this out and for the life of me just can’t do it. I hope you can help!
Essentially, I am looking to make my nav bar more user friendly and offer current page feedback. So, what I want to do is have the the current page’s ‘button’ to be highlighted when an individual has selected that particular page. I want it to use the same colours as when hovered on.
This is the code for the menu:
<div id="headmenu"> <?php if (is_search() || is_404()) { ?> <ul> <li><a href="<?php echo get_settings('home'); ?>/" title="blog">blog</a></li> <?php wp_list_pages('depth=1&sort_column=menu_order&title_li='); ?> </ul> <?php } else { ?> <ul> <li><a href="<?php echo get_settings('home'); ?>/" title="blog">blog</a></li> <?php wp_list_pages('depth=1&sort_row=menu_order&title_li='); ?> <?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) { ?> <?php echo $children; ?> <?php } ?> </ul> <?php } ?> </div>
And this is the current CSS is for that menu:
#headmenu a { color:#000; background:#fff; padding:3px 10px 2px 10px; margin:0 0px 0px 0px; line-height:21px; border: 2px solid black; border-width: 3px 3px 3px 3px; } #headmenu a:hover {text-decoration:none; color:#fff; background:#000;} #headmenu ul {margin-left;} #headmenu ul li {float:left; list-style-type:none; }
Any suggestions?
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘[How-To] – Menu: Highlight Current Page.’ is closed to new replies.