Title: Category based navigation
Last modified: August 19, 2016

---

# Category based navigation

 *  [flashpunk](https://wordpress.org/support/users/flashpunk/)
 * (@flashpunk)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/category-based-navigation/)
 * Hey there,
 * i’m attempting to create a category based navigation that would look something
   like this:
 * Main Nav: Home | Category 1 | Category 2 | Category 3 | Category 4
    Sub nav: 
   Child of Cat 2 | Child of Cat 2 | Child of Cat 2 | Child of Cat 2
 * Basically, what I want is to show the children categories of the main categories.
 * I’ve been trying to get it running with the wp_list_categories() function, but
   for some reason, it doesn’t seem to work once you get into archive pages, or 
   single entry pages.
    Here is the code i’m currently working with:
 *     ```
       <div id="upperNav">
       		<div class="navLinks"><a href="<?php bloginfo('url'); ?>"<?php if ( is_home()) { ?> id="active"<? } ?>>Home</a>  <a href="<?php bloginfo('url'); ?>/category/news/"<?php if ( is_category('news')) { ?> id="active"<? } ?>>News</a>  <a href="<?php bloginfo('url'); ?>/category/reviews/"<?php if ( is_category('reviews')) { ?> id="active"<? } ?>>Reviews</a>  <a href="<?php bloginfo('url'); ?>/category/videos/"<?php if ( is_category('videos')) { ?> id="active"<? } ?>>Videos</a>  <a href="<?php bloginfo('url'); ?>/category/features/"<?php if ( is_category('features')) { ?> id="active"<? } ?>>Features</a>  <a href="<?php bloginfo('url'); ?>/category/games/"<?php if ( is_category('games')) { ?> id="active"<? } ?>>Games</a>  <a href="<?php bloginfo('url'); ?>/shop/"<?php if ( is_category('shop')) { ?> id="active"<? } ?>>Shop</a></div>
       		<?php include (TEMPLATEPATH . '/searchform.php'); ?>
       		<div class="clearMe"></div>
       	</div>
       	<ul id="lowerNav" class="sf-menu">
       			<?php if ( is_home() || is_category('news')) {
       					$catVar = $newsCategoryVar; ## Show only if in NEWS category or home page
       				} elseif ( is_category('reviews')) {
       					$catVar = $reviewsCategoryVar; ## Show only if in REVIEWS category
       				} elseif ( is_category('videos')) {
       					$catVar = $videosCategoryVar; ## Show only if in VIDEOS category
       				} elseif ( is_category('features')) {
       					$catVar = $featuresCategoryVar; ## Show only if in FEATRUES category
       				} elseif ( is_category('games')) {
       					$catVar = $gamesCategoryVar; ## Show only if in GAMES category
       			};
       			if (isset($catVar)) {
       				## echo 'You are viewing the children of the ' . $catVar . ' Category';
       				wp_list_categories('child_of=' . $catVar . '&current_category=' . $catVar . '&hierarchical=1&title_li=0&depth=1&hide_empty=1');
       			} ?>
       	</ul>
       ```
   
 * Any help would be greatly appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [flashpunk](https://wordpress.org/support/users/flashpunk/)
 * (@flashpunk)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/category-based-navigation/#post-985042)
 * Anyone able to offer some help?
 *  Thread Starter [flashpunk](https://wordpress.org/support/users/flashpunk/)
 * (@flashpunk)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/category-based-navigation/#post-985063)
 * Still looking for some help!
    Please!!
 *  [tha10co](https://wordpress.org/support/users/tha10co/)
 * (@tha10co)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/category-based-navigation/#post-985267)
 * I’m interested too…
    Anyone can help us?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Category based navigation’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [wp_list_categories()](https://wordpress.org/support/topic-tag/wp_list_categories/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [tha10co](https://wordpress.org/support/users/tha10co/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/category-based-navigation/#post-985267)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
