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'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
  • share|improve this question
    Can you add more explanation to your question, may be few examples will help better – Maruti Mohanty Dec 3 '13 at 19:19
    added some additional info – Oliver Dec 3 '13 at 19:22
    up vote 0 down vote accepted

    Yes you can.

       $args = array(
         'theme_location' => 'primary', //change this value with coresponding menu area 
         'menu_id' => 'main-menu', //change this value with wanted menu

    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.

    share|improve this answer
    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 Dec 6 '13 at 18:26
    you are welcome. searching is always helpful :) – pendjer Dec 6 '13 at 19:38

    Your Answer


    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.