diff --git a/CHANGELOG.md b/CHANGELOG.md index 0353c797..85cf315d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # CHANGELOG +*1.9.1* (2020-01-08) +- Delete PHP Notice et Warnings (#251) + *1.9.0* (2020-01-08) - New element version 2.0.6 - Update footer diff --git a/wp-theme-2018/VERSION b/wp-theme-2018/VERSION index f8e233b2..9ab8337f 100644 --- a/wp-theme-2018/VERSION +++ b/wp-theme-2018/VERSION @@ -1 +1 @@ -1.9.0 +1.9.1 diff --git a/wp-theme-2018/menus/custom-nav-walker.php b/wp-theme-2018/menus/custom-nav-walker.php index 0a3a4075..2f447ada 100644 --- a/wp-theme-2018/menus/custom-nav-walker.php +++ b/wp-theme-2018/menus/custom-nav-walker.php @@ -62,10 +62,16 @@ public function start_lvl( &$output, $depth = 0, $args = array() ) { } } + /** + * @remark Default value of $args is an empty array but parameter can also be an object (if given).. + * A big thanks to Antistatic who coded like this... #facepalm + */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $this->currentItem = $item; - if(array_key_exists('item_spacing', $args) && $args['item_spacing'] === 'discard') { + /* Because $args can be an array or an object, we have to check differently... */ + if( (is_array($args) && array_key_exists('item_spacing', $args) && $args['item_spacing'] === 'discard') || + (property_exists($args, 'item_spacing') && $args->item_spacing == 'discard') ) { $t = ''; $n = ''; } else { @@ -167,14 +173,27 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 */ $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth ); - $item_output = array_key_exists('before', $args)? $args['before']:''; - $item_output .= ''; - $item_output .= (array_key_exists('link_before', $args)? $args['link_before']:'') . - $title . - (array_key_exists('link_after', $args)? $args['link_after']:''); - $item_output .= ''; - $item_output .= array_key_exists('after', $args)? $args['after']:''; - + if(is_array($args)) + { + $item_output = array_key_exists('before', $args)? $args['before']:''; + $item_output .= ''; + $item_output .= (array_key_exists('link_before', $args)? $args['link_before']:'') . + $title . + (array_key_exists('link_after', $args)? $args['link_after']:''); + $item_output .= ''; + $item_output .= array_key_exists('after', $args)? $args['after']:''; + } + else // $args is an object + { + $item_output = property_exists($args, 'before')? $args->before:''; + $item_output .= ''; + $item_output .= (property_exists($args, 'link_before')? $args->link_before:'') . + $title . + (property_exists($args, 'link_after')? $args->link_after:''); + $item_output .= ''; + $item_output .= property_exists($args, 'after')? $args->after:''; + } + if(is_array($item->classes) && in_array('menu-item-has-children', $item->classes)) { $item_output .= '