menus - Adding additional html to the end of the root level in a custom nav walker

I have a custom nav walker, which essentially just add's new classes to the menu, however, my menu also contains so

I have a custom nav walker, which essentially just add's new classes to the menu, however, my menu also contains some hard coded elements at the end (Contact button & Search Icon).

Where/How to I add this custom <li>'s in the nav walker to ensure that these get added in the root UL as the last items, only once?

I have a custom nav walker, which essentially just add's new classes to the menu, however, my menu also contains some hard coded elements at the end (Contact button & Search Icon).

Where/How to I add this custom <li>'s in the nav walker to ensure that these get added in the root UL as the last items, only once?

Share Improve this question asked Sep 25, 2019 at 9:37 ChrisBrathertonChrisBratherton 1134 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

Hope this code will helpful for you, add the items_wrap in wp_nav_menu to merge li's

<?php
 wp_nav_menu( array( 'theme_location' => 'primary', 'container' => '', 'menu_id' => '', 'menu_class'=> '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s<li><a href="http://www.example/contact">Contact</a></li><li><a href="javascript:void(0);">Search</a></li></ul>' ) ); ?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745131380a4612988.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信