Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #64 from jem08002/master
Changes for Issue #63
  • Loading branch information
amb00010 committed Dec 2, 2014
2 parents f5eece3 + 5e0ca19 commit cf4d68d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@

_notes/dwsync.xml

inc/_notes/dwsync.xml
76 changes: 38 additions & 38 deletions inc/submenu-check.php
@@ -1,39 +1,39 @@
<?php
$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($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){
$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-8 col-sm-offset-1">
<?php
$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($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){
$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 */?>
Empty file modified sidebar.php 100755 → 100644
Empty file.

0 comments on commit cf4d68d

Please sign in to comment.