Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a category X of posts. The category page and it's individual posts are all part of a custom menu consisting of pages and posts. My submenu, in the sidebar, works fine for showing on the pages, but doesn't show up at all on the category page or any of its posts. How can I get it to show up?

EDIT:

I solved this, see below (in the comments) for explanations of my two solutions.

Solution 1:

<?php if( is_singular('menus')) { ?> 
  <nav role="inner"> 
    <ul><?php wp_list_pages('title_li=&child_of=8'); ?></ul> 
  </nav> 
<?php } ?>

Solution 2:

<?php if( is_singular('venues'))  { ?>
  <nav role="inner">
    <?php wp_nav_menu(array ("theme_location" => "venue-menu")) ?>
  </nav>
<?php } ?>
share|improve this question
    
You should post your solutions as an answer and accept your own answer :-) –  Pieter Goosen Sep 16 at 9:56

1 Answer 1

Well it looks like you are using theme that doesn't have custom menu supporting code inside post and category templates. Since it's working fine in page template you should go to Appearance -> Editor and open for editing page.php or index.php and look for wp_nav_menu() with all it's arguments. Select and copy and insert it inside your category and page template.

That's the basic idea but it depends how your theme is implemented. If you provide me with more details I might help you more precisely.

share|improve this answer
    
hm.. maybe I just don't understand how the menu works. I am using custom menus which I defined in Appearance>Menus; it shows up fine on all pages but not posts, categories, etc. When I go in the index.php or page.php, I don't see wp_nav_menu() at all - I just see a sidebar include: <?php get_sidebar(); ?> I am using the twentyeleven theme which I have been customizing. –  jamie Sep 5 '12 at 17:01
    
I put the get_sidebar(); call into the single templates and no change.. any ideas? –  jamie Sep 5 '12 at 17:14
    
you can edit single.php and add <?php get_sidebar(); ?> then play with css to accommodate sidebar on post page. or just rename single.php to single.bak for Wordpress to display post using page template(which natively supports sidebar) –  daniel.tosaba Sep 7 '12 at 7:50
    
    
here is what I ended up doing, which works a charm. I put this in my sidebar.php. Basically, it works with the custom post type name to check that it's a single post with that type. If so, I tell it to append a list of all the pages that are children of Page ID 8. <?php if( is_singular('menus')) { ?> <nav role="inner"> <ul><?php wp_list_pages('title_li=&child_of=8'); ?></ul> </nav> <?php } ?> –  jamie Sep 12 '12 at 0:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.