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 Dec 3, 2013 at 19:19
    • added some additional info
      – Oliver
      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

    Your Answer

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

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