Page and category dropdowns

<ul id="sub-nav" class="span-38">
<? drop_down_menu('Get Fit', '3'); ?>
<? drop_down_menu('Eat Smart', '4'); ?>
<? drop_down_menu('Dine Healthy', '5'); ?>
<? drop_down_menu('Calm Stress', '6'); ?>
<? drop_down_menu('Look Beautiful', '7'); ?>
<? drop_down_menu('Get Personal', '231'); ?>
<? drop_down_menu('Empower Yourself', '234'); ?>
<? drop_down_menu('Shop Local', '42'); ?>
<? drop_down_menu('Give Back', '252'); ?>
<? drop_down_menu('Books, Videos & More', '254'); ?>
</ul>

<!-- this alternative allows you to intermix page and categories in the nav -->
<ul id="sub-nav" class="span-38">
<?php wp_list_pages('include=2&title_li='); ?>
<? drop_down_menu('Get Fit', '3'); ?>
<?php wp_list_pages('include=6&title_li='); ?>
</ul>

<?php
//This is the function for functions.php
function drop_down_menu($title, $cat) {
?>
<li><a href="#"><? echo $title; ?></a>
<ul>
<? $categories = get_categories('child_of=' . $cat . '&hide_empty=0');
foreach ($categories as $cat) { ?>
<li><a href="/topics/<? echo $cat->slug; ?>/"><? echo $cat->name; ?></a></li>
<? } ?>
</ul>
</li>
<? } ?>

0 Comments

You must be logged in to post a comment.