How to print a custom menu in Drupal 7?

前端 未结 3 1080
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 06:53

I have created a menu in Drupal 7 and created links to pages under that menu.

I named my new menu \"Site Menu\"

In my page.tpl.php where I want my menu to appear

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 07:19

    Well, it is bit confusing from above solutions to print menu. But below code worked for me, hope this will work for y'all,

        $search_menu_name = "menu-search-box-menu";
    
       print theme('links', array('links' => menu_navigation_links($search_menu_name), 'attributes' => array('id' => $search_menu_name, 'class'=> array('links', 'inline'))));
    

    The above code is like this, "menu-search-box-menu" is my custom menu name/ID. You can find it in that particular menu edit link.

    Enjoy. :)

提交回复
热议问题