0

I've searched a lot but didn't find an answer ...

My Wordpress has got 4 main areas, each one also has a news (posts) section and an own submenu. If I load a post (with single.php) is it possible to get the corresponding submenu to that area? I'm thinking about sub stringing the slug to get the right area.

Help is really appreciated.

Thx, Oliver

Additional Info:

  • There is a sidebar which I also show in single.php
  • The sidebar should contain the menu tree of one area
  • A post is not connected to the menu
  • 2
    • 1
      Can you add more explanation to your question, may be few examples will help better Commented Dec 3, 2013 at 19:19
    • added some additional info
      – Oliver
      Commented Dec 3, 2013 at 19:22

    1 Answer 1

    0

    Yes you can.

     <?php 
       $args = array(
         'theme_location' => 'primary', //change this value with coresponding menu area 
         'menu_id' => 'main-menu', //change this value with wanted menu
              ); 
        wp_nav_menu($args);
        ?> 
    

    menu_id is the name of menu created in WP admin>Menus. I create menu with name "Main menu" so I put main-menu there. That menu is connected with my primary menu area in WP admin>Menus.

    Change those values with your values and place that code into single.php in wanted area... or any other template.

    2
    • thanks for pointing out wp_nav_menu. finally i used the solution at wordpress.stackexchange.com/questions/2802/… little bit more searching would have been good ;)
      – Oliver
      Commented Dec 6, 2013 at 18:26
    • you are welcome. searching is always helpful :)
      – pendjer
      Commented Dec 6, 2013 at 19:38

    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.