Adding a anchor tag around the title
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 23 Jun 2016 20:44:32 +0000 (16:44 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 23 Jun 2016 20:44:32 +0000 (16:44 -0400)
Ian will have to style this one.

lib/menu-walker.php

index 75bfec8..39e0c1f 100644 (file)
@@ -20,7 +20,6 @@ class Glm_Theme_Top_Bar_Walker extends Walker_Nav_Menu {
         static $saveParent = 0, $title = '';
         $item_html = '';
         parent::start_el( $item_html, $object, $depth, $args );
-        //echo '<pre>$object: ' . print_r($object, true) . '</pre>';
 
         // Insert style to display page's thumbnail
         if ( $depth == 0 ) {
@@ -29,13 +28,12 @@ class Glm_Theme_Top_Bar_Walker extends Walker_Nav_Menu {
         }
         if ( !$title && $depth == 1 ) {
             // get the page title from parent
+            $permalink = get_the_permalink( $saveParent->object_id );
             $title = get_the_title( $saveParent->object_id );
-            $output .= '<li><h1>' . $title . '</h1></li>';
+            $output .= '<li><h1><a href="' . $permalink . '">' . $title . '</a></h1></li>';
         }
-        //$output .= ( 0 == $depth ) ? '<li class="divider"></li>' : '';
         $classes = empty( $object->classes ) ? array() : (array) $object->classes;
         if ( in_array( 'label', $classes ) ) {
-            //$output .= '<li class="divider"></li>';
             $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '<label>$1</label>', $item_html );
         }
         if ( in_array( 'divider', $classes ) ) {