Last active
March 8, 2016 02:23
-
-
Save alexkalh/a14594ab80c6ed6c798e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Remove warning : Invalid argument supplied for foreach() on functions.php on line 451 | |
* @version 1.2 | |
* | |
* Open file: wp-content/themes/enliven/inc/functions.php | |
* | |
* Select codes from 444 to 458 | |
* Replace it by new codes below: | |
* | |
*/ | |
if ( ! function_exists( 'enliven_add_first_and_last_class_for_menuitem' ) ) { | |
function enliven_add_first_and_last_class_for_menuitem( $items ) { | |
$parent = array(); | |
if( !empty( $items ) ){ | |
foreach ( $items as $k => $v ) { | |
$parent[ $v->menu_item_parent ][] = $v; | |
} | |
} | |
if( !empty( $parent ) ){ | |
foreach ( $parent as $k => $v ) { | |
$v[0]->classes[] = 'enliven-menu-item-first'; | |
$v[ count( $v ) -1 ]->classes[] = 'enliven-menu-item-last'; | |
} | |
} | |
return $items; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment