0

I am trying to organize my menus in my website. Since the structure is pretty complex I need some help with displaying the menus.

In the documentation of WP there is this example:

Africa: Cameroon Lesotho Swaziland Togo South Amerika So the permalink() for Cameroon will be: http://example.com/africa/cameroon/

But in my structure I need something like this:

http://example.com/africa/cameroon/street

In other words I have 2 parent pages A and B. B has 4 children(o,p,q,r(One menu should be shown for navigation around those children-menu1).O,p,q,r also have children. For example, o has a,y,x).So page o is child of B, thus one menu should be shown(menu2). BUT, o has children x,y,z so x,y,z should see both menu2, menu1 How to make the relation? I need to display different menu for all belongings of B but also extra menu for those who are children of the children of B. I give you example with displaying a menu for all pages of type B:

   <div class="localnavDiv">
    <ul class="localNav">



        <?php 
    if($post -> post_parent == $par_explore ->ID)
    {
        $items=wp_nav_menu
            ( array( 'theme_location' =>  'footer', 
                    'menu_class' => 'nav-menu', 
                    'fallback_cb' => false ) );
        if (is_array($items) || is_object($items))
        {

            foreach($items as $item)
            { ?>
<li  class="liNav"  id="liRight" ><a class="active"   id="rightTitle"    href="http://localhost:81/DEMO/who-already-joined/"   onclick="myFunction()" ><?php echo $item ?></a></li>

<?php    
            }
        }
    }



        if($post -> post_parent == $par_develop ->ID)
    {
        $items=wp_nav_menu
            ( array( 'theme_location' =>  'develop', 
                    'menu_class' => 'nav-menu', 
                    'fallback_cb' => false ) );
        if (is_array($items) || is_object($items))
        {

            foreach($items as $item)
            { ?>
<li  class="liNav"  id="liRight" ><a class="active"   id="rightTitle"    href="http://localhost:81/DEMO/who-already-joined/"   onclick="myFunction()" ><?php echo $item ?></a></li>

        foreach($explore_children as $exChild)
{*/



<?php    
            }
        }
    }

    // }


?>




</ul>

Illustration of the exampkle

I suppose, I can use category. So page B is parent of page O and page x belongs to category (to replace O as a pernt).

I hope you understand a bit the problem.

Thank you!

0

I may be completely misunderstanding your question but I think you're trying to create something like the image below. Correct?

enter image description here

If that's the case you would create the menu structure either using the "Customize" or the "Menu" option in the "Appearance" menu in Wordpress.

enter image description here

The you simply arrange menu items the way you want them by dragging.

See below for the example I just created in a development site I'm working on.

enter image description here

Hope that helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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