简体   繁体   English

在wordpress中wp_nav_menu函数的末尾添加一个div

[英]add a div at the end of wp_nav_menu function in wordpress

I want to add a div at the bottom of the wordpress wp_nav_menu so it will look like this:我想在 wordpress wp_nav_menu 的底部添加一个 div,所以它看起来像这样:

<ul>
  <li>...</li>
  <li>...</li>
  <li>...</li>

  <div class="my-div"></div>
</ul>

I can't seem to find a way to do it in the function document on wordpress, can anyone please help?我似乎无法在 wordpress 的功能文档中找到一种方法,任何人都可以帮忙吗?

Try this code:试试这个代码:

   wp_nav_menu( 
                 array(
                        'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s <div class="my-div"></div></ul>'
                      )
                );

尝试这个 :

wp_nav_menu(array('items_wrap' => '<ul>%3$s <div class="my-div"></div></ul>',));

Just Replace items_wrap with below line只需用下面的行替换items_wrap

 wp_nav_menu(array(
                    'items_wrap' => '<ul>%3$s <div class="my-div"></div></ul>',
                ));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM