1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

WordPress Hack: Creating a Two-Tiered Navigation Menu

Mar 12 2008

Category: Themes and Tricks

Download | Demo

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:


Read it at the source

Leave a Reply