Hot answers tagged

1

You are not defining a certain width to each item from the second list, you could use the following to modify the styling for the submenu: ul li ul li { float: none; display: block; width: 100%; } It will look like this: You could also try using CSS Grid or CSS Flex to accomplish the structure.


1

After some testing I found the best way is to use a walker. For this example lets say that this is the code that calls our menu wp_nav_menu([ 'container' => false, 'theme_location' => 'right-side-top-menu', 'walker' => new Menu_Middle_Logo() ]); Now for our walker, there isn't an easy way to determine which of the ...


1

It's not working for two reasons. You have echo set to false. This means it won't output anything unless you echo it manually. The resulting HTML structure is invalid. You have items_wrap set it %3$s. This means that the individual menu items, which are <li> tags, will be output without a wrapper. That would make the final structure this: <ul> ...


1

Here's a one-liner that checks the $children_elements for the existence of the $element->ID as a top-level array key and is, therefore, a parent. $is_parent = array_key_exists( $element->ID, $children_elements ); EDIT: I should have mentioned this must be used in Walker method display_element so to use this you would add the method to your custom ...


Only top voted, non community-wiki answers of a minimum length are eligible