Tag Info

New answers tagged

0

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 * @todo ...


0

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.


0

I have the same issue. Some answers claim that you can use $args->has_children or $args[0]->has_children, but it's never added to $args. Sometimes, has_children is added under $args->walker->has_children, but it's always set to false, in other words, useless... As a work around, the current template that I'm using adds a class to items that ...


0

Count the level 0 elements in a static variable in the method and add an extra class if you hit the third. Sample code: function start_lvl(&$output, $depth) { static $column = 1; $indent = str_repeat("\t", $depth); if ($depth > 0) { $output .= "\n$indent<ul class='subsubmenu'>\n"; } else { $column += ...


0

If "line 45" is the one that starts with $element->classes[] in your display_element method then try something like this: public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { $element->has_children = ! empty( $children_elements[ $element->ID ] ); if ( ! isset( ...



Top 50 recent answers are included