Creating custom Menu for custom theme

You can remove the container and ul tag like this: <?php wp_nav_menu( array( ‘container’ => ”, ‘items_wrap’ => ‘%3$s’ ) ); ?> Now you can see an architecture like this: <li> <a href=”#”>item</a> </li> And i think you could adjust your stylesheet to adapt “li” tag. Hope it helps.

How I can add div to menu?

When using wp_nav_menu you can pass arguments to it which help you style the output, look at: $container Whether to wrap the ul, and what to wrap it with. Allowed tags are div and nav. Use false for no container e.g. container => false . $container_class the class that is applied to the container. $container_id … Read more

Walker_Nav_Menu Add Strings and Class Name

This drove me crazy. Here is the solution, hope someone find it useful or suggest a better and shorter solution: class sstmyp_Walker_Nav_Menu extends Walker_Nav_Menu { function display_element($element, &$children_elements, $max_depth, $depth=0, $args, &$output) { $id_field = $this->db_fields[‘id’]; // add custom class and carets to menu has children if(in_array(“menu-item-has-children”, $element->classes)) { $element->classes[] = ‘dropdown’; $element->title .= ‘ … Read more

Using wp_list_categories or other function inside a menu walker?

Here is my code to edit menu item, maybe it can help you: class SB_Menu_Walker extends Walker_Nav_Menu { /** * What the class handles. * * @see Walker::$tree_type * @since 3.0.0 * @var string */ public $tree_type = array(‘post_type’, ‘taxonomy’, ‘custom’); /** * Database fields to use. * * @see Walker::$db_fields * @since 3.0.0 * … Read more