diff --git a/inc/Walker_OERU_Menu_Depth.php b/inc/Walker_OERU_Menu_Depth.php
index 2f6435a..ece842e 100644
--- a/inc/Walker_OERU_Menu_Depth.php
+++ b/inc/Walker_OERU_Menu_Depth.php
@@ -2,13 +2,13 @@
class Walker_OERU_Menu_Depth extends Walker {
- // Tell Walker where to inherit it's parent and id values
- var $db_fields = array(
- 'parent' => 'menu_item_parent',
- 'id' => 'db_id'
- );
+ // Tell Walker where to inherit its parent and id values
+ var $db_fields = array(
+ 'parent' => 'menu_item_parent',
+ 'id' => 'db_id'
+ );
- var $first = false;
+ var $fixup = false;
function start_lvl( &$output, $depth = 0, $args = array() ) {
@@ -32,7 +32,6 @@ function end_lvl( &$output, $depth = 0, $args = array() ) {
}
function end_el( &$output, $object, $depth = 0, $args = array() ) {
-
if($depth<=0){
$output .= "";
@@ -42,61 +41,69 @@ function end_el( &$output, $object, $depth = 0, $args = array() ) {
}
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
-
if($depth<=1){
- $page_class = "";
-
- foreach($item->classes as $index => $class){
-
- if(strpos($class,"-")===FALSE){
+ $page_class = "";
- $page_class .= $class . " ";
- unset($item->classes[$index]);
+ foreach($item->classes as $index => $class){
+
+ if(strpos($class,"-")===FALSE){
+
+ $page_class .= $class . " ";
+ unset($item->classes[$index]);
+
+ }
}
-
- }
-
- $item->classes[] = str_replace(" ", "-", strtolower(trim($page_class)));
-
- if(in_array("menu-item-has-children",$item->classes)){
- $item->classes[] = "dropdown";
- }
-
- if($item->menu_item_parent!=0){
- $item->classes[] = "sub-menu";
- }else{
- $item->classes[] = "parent-menu";
- }
-
- if($depth !=0){
- if(($key = array_search("menu-item-has-children", $item->classes)) !== false) {
- unset($item->classes[$key]);
- }
- }
-
- $output .= "
object_id === get_the_ID() ) {
- $output .= " class='current' ";
- }
-
- if($depth == 0){
- $output .= " href='#' data-toggle='dropdown' class='dropdown-toggle'>" . $item->title;
- }else{
- $output .= " href='" . $item->url . "'>" . $item->title;
- }
-
- if($depth==0){
+
+ $item->classes[] = str_replace(" ", "-", strtolower(trim($page_class)));
if(in_array("menu-item-has-children",$item->classes)){
- $output .= "";
+ $item->classes[] = "dropdown";
}
+
+ if($item->menu_item_parent!=0){
+ $item->classes[] = "sub-menu";
+ }else{
+ $item->classes[] = "parent-menu";
+ }
+
+ if($depth !=0){
+ if(($key = array_search("menu-item-has-children", $item->classes)) !== false) {
+ unset($item->classes[$key]);
+ }
+ }
+
+ $output .= "object_id === get_the_ID() ) {
+ $output .= " class='current' ";
+ }
+
+ if($depth == 0){
+ $output .= " href='#' data-toggle='dropdown' class='dropdown-toggle'>" . $item->title;
+ }else{
+ if ( in_array( 'dropdown', $item->classes ) ) {
+ $output .= ' href="-OERU--SECOND-LEVEL-MENU">' . $item->title;
+ $fixup = true;
+ } else {
+ $output .= " href='" . $item->url . "'>" . $item->title;
+ }
+ }
+
+ if($depth==0){
+
+ if(in_array("menu-item-has-children",$item->classes)){
+ $output .= "";
+ }
+
+ }
+
+ $output .= "";
- }
-
- $output .= "";
-
+ } else if ( fixup && ( $depth == 2 ) ) {
+ // backfill the last first second level URL with the first third level one
+ $output = str_replace( '-OERU--SECOND-LEVEL-MENU', $item->url, $output );
+ $fixup = false;
}
}
diff --git a/style.css b/style.css
index caed4b6..7fdcf36 100644
--- a/style.css
+++ b/style.css
@@ -3,7 +3,7 @@ Theme Name: OERu Course Theme
Author: Pgogy Webstuff
Author URI: http://pgogywebstuff.com
Description: Open Class Theme for the OERu
-Version: 0.5.8
+Version: 0.6.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, rtl-language-support, sticky-post, theme-options