0

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?

0

2 Answers 2

1

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

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.

7
  • 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
    Commented Sep 5, 2012 at 17:01
  • I put the get_sidebar(); call into the single templates and no change.. any ideas?
    – jamie
    Commented Sep 5, 2012 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) Commented Sep 7, 2012 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
    Commented Sep 12, 2012 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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