Dami Sadiq
Dami Sadiq

Reputation: 1

How to change a ul element to a div on the wp_nav_menu|

change the ul to a div

I need to change the ul tag to become a div. I have changed the class from sub-menu to nav__list-sub-alt nav__dropdown js-nav-next using the code below

echo str_replace('sub-menu', 'nav__list-sub-alt nav__dropdown js-nav-next', wp_nav_menu( $defaults)
);

However I need to change the ul tag to a div tag

enter image description here

Upvotes: 0

Views: 781

Answers (1)

you can change ul to whatever suits you, check out the documentation at https://developer.wordpress.org/reference/functions/wp_nav_menu/ and look for items_wrap, default markup is <ul id="%1$s" class="%2$s">%3$s</ul> which can be replaced with anything.

Upvotes: 1

Related Questions