forked from weblab/cornerstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set default menu style on left nav check
- Loading branch information
Showing
1 changed file
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
<?php | ||
$navoption1 = get_option( 'navoption1'); | ||
|
||
$has_sub_menu = false; | ||
$menu_name = 'primary'; | ||
$current_id = 0; | ||
if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) { | ||
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); | ||
$menu_items = wp_get_nav_menu_items($menu->term_id); | ||
$level = 0; | ||
$stack = array('0'); | ||
if(is_array($menu_items)){ | ||
foreach($menu_items as $key => $menu_item) { | ||
if($menu_item->object_id == get_the_ID()) $current_id = $menu_item->ID; | ||
} | ||
foreach($menu_items as $key => $menu_item) { | ||
while(in_array($menu_item->menu_item_parent, $stack) && $menu_item->menu_item_parent != array_pop($stack)) { | ||
$level--; | ||
} | ||
$level++; | ||
$stack[] = $menu_item->menu_item_parent; | ||
$stack[] = $menu_item->ID; | ||
$menu_items[$key]->level = $level; | ||
|
||
if($menu_item->menu_item_parent == $current_id && $level > 2 || $menu_item->ID == $current_id && $level > 2 && $navoption1 == 'drop'){ | ||
$has_sub_menu = true; | ||
} | ||
} | ||
} | ||
//print_r($menu_items); | ||
} | ||
if($has_sub_menu){ | ||
?> | ||
<div class="row"> | ||
<div class="col-sm-3"> | ||
<nav id="nav-secondary"> | ||
<?php include('sidemenu-walker.php')?> | ||
</nav> | ||
</div> | ||
<div class="col-sm-9"> | ||
<?php | ||
$navoption1 = get_option( 'navoption1', 'drop' ); | ||
|
||
$has_sub_menu = false; | ||
$menu_name = 'primary'; | ||
$current_id = 0; | ||
if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) { | ||
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); | ||
$menu_items = wp_get_nav_menu_items($menu->term_id); | ||
$level = 0; | ||
$stack = array('0'); | ||
if(is_array($menu_items)){ | ||
foreach($menu_items as $key => $menu_item) { | ||
if($menu_item->object_id == get_the_ID()) $current_id = $menu_item->ID; | ||
} | ||
foreach($menu_items as $key => $menu_item) { | ||
while(in_array($menu_item->menu_item_parent, $stack) && $menu_item->menu_item_parent != array_pop($stack)) { | ||
$level--; | ||
} | ||
$level++; | ||
$stack[] = $menu_item->menu_item_parent; | ||
$stack[] = $menu_item->ID; | ||
$menu_items[$key]->level = $level; | ||
|
||
if($menu_item->menu_item_parent == $current_id && $level > 2 || $menu_item->ID == $current_id && $level > 2 && $navoption1 == 'drop'){ | ||
$has_sub_menu = true; | ||
} | ||
} | ||
} | ||
//print_r($menu_items); | ||
} | ||
if($has_sub_menu){ | ||
?> | ||
<div class="row"> | ||
<div class="col-sm-3"> | ||
<nav id="nav-secondary"> | ||
<?php include('sidemenu-walker.php')?> | ||
</nav> | ||
</div> | ||
<div class="col-sm-9"> | ||
<?php } /* end checkMenu */?> |