WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

Posting answer found by the OP, as originally edited into the question and expanded on in comments:

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 } ?>

Just for the record, I had to use another solution for a submenu that only existed in the Custom Menus. It works the same as the above solution but calls the venue-menu I registered in my functions.php and then defined in the custom menus section. wp_nav_menu() automatically outputs content in a <ul> so no need to add it in the HTML here:

<?php if( is_singular('venues'))  { ?>
  <nav role="inner">
    <?php wp_nav_menu(array ("theme_location" => "venue-menu")) ?>
  </nav>
<?php } ?>
share|improve this answer

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.