• Hello there,

    I am using my own logic to create a menu which have “|” after a menu name. Here is the code i use to get the output.

    <?php
    $menu ="Main Menu";
    $items = wp_get_nav_menu_items($menu);
    $ticker_k = count($items);
    for ( $m=0;$m<=$ticker_k-1;$m++ )
    	{
    		if (($ticker_k - $m) === 1) {?>
              <li> <a target="<?php echo $items[$m]->target; ?>" href="<?php echo $items[$m]->url ; ?>" class="menu_li"><?php  echo $items[$m]->title; ?></a>   </li>
              <?php }else {?>
    
              <li> <a target="<?php echo $items[$m]->target; ?>" href="<?php echo  $items[$m]->url ; ?>" class="menu_li"><?php  echo $items[$m]->title; ?></a> <span>|</span> </li>
              <?php }
    	}
    ?>

    Don’t upset. The result will be like this ??

    Home | About | Contact US

    But i want to add Dropdown support too for this menu. Any one have any idea about this.?

    Note : Ok. If you don’t understand my code bla bla bla.. then just tell me an easy way to enable dropdown menu support in my template.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    So what happens at the moment when you assign a page to a menu item (as parent)?

    Thread Starter jitheshkt

    (@jitheshkt)

    @andrew Nevins :

    This is my menu stricture i added through the admin panel

    Home
    About
    -Vision
    Contact Us

    But i am getting this result

    Home | About | Vision | Contact Us

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you post your HTML structure of the menu?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If you’re interested, you can also create a menu to use a border-right in-place of “|”, through CSS.

    Thread Starter jitheshkt

    (@jitheshkt)

    ?? But adding border right instead of “|” will give a “|” to the last menu item too. I don’t need “|” for the last menu item. See that.? ok. But that is not the issue now. My requirement is i want to enable sub menu support (sub menu as a drop down to its parent). There is no more html bro. You see my php code.? it is just generate following HTML :

    <ul>
    <li></li>
    </ul>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Assuming you’re working on windows, can you right click your web page and ‘View source’, then copy the contents of this pop-up view source code into Pastebin.com and link us it?

    I just want to see whether your menu generated uses correct hierarchy of elements needed for the drop down.

    Thread Starter jitheshkt

    (@jitheshkt)

    @ Andrew Nevins : Here you go. Please look for the class “<div class=”menuWrapper width-24″>”.

    https://pastebin.com/Yn07Vaw3

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Enabling Dropdown menu in my template’ is closed to new replies.