php - Stric Standard error with WordPress nav walker function -


the themeforest support tell me have 2 errors in wordpress theme: this , this.

this wp_nav_menu walker function:

class description_walker extends walker_nav_menu {    function start_el(&$output, $item, $depth, $args )   {        global $wp_query;        $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';         $class_names = $value = '';         $classes = empty( $item->classes ) ? array() : (array) $item->classes;         $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );        $class_names = ' class="'. esc_attr( $class_names ) . '"';         $output .= $indent . '<li id="menu-item-'. $item->id . '"' . $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 )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';         if($depth != 0)        {                  $description = $append = $prepend = "";        }          $item_output = $args->before;         $item_output .= '<a'. $attributes .' class="external">';         $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->id );         $item_output .= '</a>';         $item_output .= $args->after;          $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                      if ($item->menu_order == 1) {             $classes[] = 'first';         }          } } 

the problem wordpress doesnt show errors. have wordpress 3.8.1 , havewp_debug` set true.

the first error seems fixed changing line: function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0). second error have change $item_output = $args->before; $item_output = $args['before']; cause error:

fatal error: cannot use object of type stdclass array in /home/codetoco/public_html/wp-content/themes/quins/functions.php on line 338

why getting error me not? how can fix errors?

the second error have change $item_output = $args->before; $item_output = $args['before']; cause error:

fatal error: cannot use object of type stdclass array in /home/codetoco/public_html/wp-content/themes/quins/functions.php on line 338

its because $args object , not array need use -> instead of []

you might want check out this find more enabling error reporting in php. helps enable error reporting during development informs when wrong. sure disable when push code live server can potential cause leaking information don't want outside world know.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -