WordPress outputs my child menus inside this ul tag…
<ul class="sub-menu">
how can I wrap a simple div around it?
Preferably a way to do it through functions.php, but jquery can work too.
WordPress outputs my child menus inside this ul tag…
<ul class="sub-menu">
how can I wrap a simple div around it?
Preferably a way to do it through functions.php, but jquery can work too.
You must be logged in to post a comment.
While it would be EASY to use something like jQuery to wrap your child menus, it is NOT good practice to use jQuery for this purpose. Place this in functions.php:
I’m assuming that your menu is being generated in your header, so go to header.php (or whatever file is utilizing the wp_nav_menu function) and look for anything that starts with “wp_nav_menu”.
Since I don’t have any code to see, I can only guess the arguments that it’s using (if any). If it looks EXACTLY like “wp_nav_menu()” with nothing in between the parenthesis, then change it to the following:
Otherwise, please edit your question with the code that your menu is using so I can help you further.
In the function.php
Call to the function where your wp_nav_menu is located.(Ex: header.php)
If you want to do this using jquery, you can do this as following.But best ways is first method.In here sometimes display as messed the menu when loading the page.