Skip to content

Commit

Permalink
Fix error in empty menu locations procedure assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
francgrasso committed May 22, 2020
1 parent 47d2254 commit 17c6d55
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ function yith_proteo_setup() {
/**
* Fix empty menu locations
*/
$menu_locations = get_theme_mod( 'nav_menu_locations' );
$menu_locations = get_theme_mod( 'nav_menu_locations' );
$update_menu_locations = false;
if ( ! isset( $menu_locations['primary'] ) && isset( $menu_locations['menu-1'] ) ) {
set_theme_mod( 'nav_menu_locations', array_merge( $menu_locations, array( 'primary' => $menu_locations['menu-1'] ) ) );
$menu_locations = array_merge( $menu_locations, array( 'primary' => $menu_locations['menu-1'] ) );
$update_menu_locations = true;
}
if ( ! isset( $menu_locations['mobile'] ) ) {
set_theme_mod( 'nav_menu_locations', array_merge( $menu_locations, array( 'mobile' => $menu_locations['primary'] ) ) );
$menu_locations = array_merge( $menu_locations, array( 'mobile' => $menu_locations['primary'] ) );
$update_menu_locations = true;
}

if ( $update_menu_locations ) {
set_theme_mod( 'nav_menu_locations', $menu_locations );
}

/*
Expand Down

0 comments on commit 17c6d55

Please sign in to comment.