简体   繁体   中英

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:

<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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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