Menus are an excellent way to create a menu of categories or Pages, highlighting specific areas of interest within your website.
Dynamic menu highlighting is a way to give users a reference point with which to navigate. It is like the dot on the map that says “you are here”.
Nick La created a dynamic highlight menu on Best Web Gallery by using the code below:<ul id="nav">
<li<?php if ( is_home() || is_category() || is_archive() || is_search() || is_single() || is_date() ) { echo ' class="current"'; } ?>><a href="#">Gallery</a></li>
<li<?php if ( is_page('about') ) { echo ' class="current"'; } ?>><a href="#">About</a></li>
<li<?php if ( is_page('submit') ) { echo ' class="current"'; } ?>><a href="#">Submit</a></li>
</ul>
Further Reading on Navigation Menu
1)Creating Two-Tiered Conditional Navigation in Wordpress- Here is a common navigational scheme, with parent pages on top and child pages (if they exist) on bottom.
2) Smarter Navigation Menu Mike Cherim has explained how to get a smarter navigation menu using Conditional tags by offering post titles, archive dates, and category names instead of generic terminology.<!--Begin an unordered list the ID is for the bookmark, the class is for the style
(so I can have other lists with the same styling as seen on RedScrubs.com)-->
<ul id="nav" class="btn">
<!--IF the current page is the 404 page, note the added error class-->
<?php if(is_404()) { ?>
<li class="current_page_item error"><a href="#">404 Error</a></li>
<?php } ?>
<!--IF the current page is the search results page-->
<?php if(is_search()) { ?>
<li class="current_page_item"><a href="#">Search Results</a></li>
<?php } ?>
<!--IF the current page is a single post-->
<?php if(is_single()) { ?>
<li class="current_page_item"><a href="#">Selected Article</a></li>
<?php } ?>
Creating Navigation Menu in wordpress-Wordpress Hacks
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment