0

I updated my WordPress to Version 4.5 yesterday, and the below warnings were show

Warning: Declaration of Walker_Nav_Menu_Dropdown::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = Array) in /homepages/7/d610643512/htdocs/clickandbuilds/chattepoilue/wp-content/themes/novavideo/_front/mobile-nav.php on line 0

Warning: Declaration of Walker_Nav_Menu_Dropdown::end_el(&$output, $item, $depth) should be compatible with Walker_Nav_Menu::end_el(&$output, $item, $depth = 0, $args = Array) in /homepages/7/d610643512/htdocs/clickandbuilds/chattepoilue/wp-content/themes/novavideo/_front/mobile-nav.php on line 0 

Here is the code from file described in the error :

class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{
function start_lvl(&$output, $depth = 0, $args = array()) {
  $indent = str_repeat("\t", $depth); // don't output children opening tag ('<ul>')
}

function end_lvl(&$output, $depth){
  $indent = str_repeat("\t", $depth); // don't output children closing tag
}

function start_el(&$output, $item, $depth, $args){
  // add spacing to the title based on the depth
  $item->title  = str_repeat("&nbsp;", $depth * 4) . $item->title;
  $class_names  = isset( $class_names ) ? $class_names : null;
  $indent       = isset( $indent ) ? $indent : null;
  $value        = isset( $value ) ? $value : null;
  $item_output  = isset( $item_output ) ? $item_output : null;


    $output .= '<option'. $indent . $value . $class_names;  
    $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) . '"' : '';  
    $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) . '"' : '';  
    $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) . '"' : '';  
    $attributes .= ! empty( $item->url )        ? ' value="'  . esc_attr( $item->url        ) . '"' : '';  

    $item_output .= $attributes . '>';  
    $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID );  
    $item_output .= '';  

    $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );    

  // no point redefining this method too, we just replace the li tag...
  $output = str_replace('<li', '<option', $output);
}

function end_el(&$output, $item, $depth){
  $output .= "</option>\n"; // replace closing </li> with the option tag
}

}

  • It's telling you that your parameters don't match exactly the parameters from the original class. It then goes on to give you the parameters. So to make this error go away just copy / paste in the parameters it's telling you to – Howdy_McGee Apr 18 '16 at 19:06
  • Yep..by replacing the code, error was removed...Thanks @Howdy_McGee – Piyush Rawat Apr 18 '16 at 19:16

Browse other questions tagged or ask your own question.