WordPress Hack: Creating a Two-Tiered Navigation Menu
Category: Themes and Tricks
- CSS We Are The Buzz




(5 out of 5) - Throw




(5 out of 5) - qmula




(5 out of 5) - Heartworker




(5 out of 5) - Decently Exposed




(5 out of 5) - Gmcosta




(5 out of 5) - FreelanceDaddy




(5 out of 5) - LifeStyle Web




(5 out of 5) - Tech Tunes




(5 out of 5) - ADVANCEDMINORITY




(5 out of 5)
If you’ve been following the recent trends with premium WordPress themes, you’ve probably noticed that the two-tiered navigation menu has become extremely popular. An example of this is the popular Revolution WordPress themes. This style of menu can be used in a variety of ways, but the most common seems to be to display your children pages in a menu below your blog’s parent pages.
If you’ve wondered how to hack your existing WordPress theme to accomplish something along these lines, Darren Hoyt has taken the time to explain this in his post Creating Two-Tiered Conditional Navigation in WordPress. Here is the PHP you’ll need:
<ul id="nav">
<?php wp_list_pages(’title_li=&depth=1′); ?>
</ul>
<?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) { ?>
<ul id=”subnav”>
<?php echo $children; ?>
</ul>
<?php } else { ?>
<?php } ?>
Once you’ve got the code in place, you’ll want to style it to look the way you want it to. Click over to Darren’s post to get the styling information!
—
Enjoy writing about WordPress? Get yourself more exposure by joining the Hack WordPress writing team!
Digg This Post! | Stumble This Post! | Add this Post to Del.icio.us | Google Bookmark This Post! | Netscape it! | No comment
Hack WordPress © 2008
—
Related Articles at Hack WordPress:
- How To: Display WordPress Categories in a Horizontal Drop-Down Menu
- How To: Hide Individual WordPress Pages
- Great List of WordPress Theme Hacks
- Feature Posts with the WP-Sticky WordPress Plugin
- Group Your Posts With the In Series WordPress Plugin
- How To: Picking Out a Good WordPress Theme

