From: Steve Sutton Date: Thu, 8 Jan 2015 15:30:38 +0000 (-0500) Subject: Update menus X-Git-Tag: v1.0.0^2~50 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=2f9cf7aafbeb41a9cda79c21d99436df4efb6da2;p=WP-Themes%2Fmuerkitchens.git Update menus only show the main level and in mobile view show the home page also --- diff --git a/functions.php b/functions.php index cd789cb..a9ff8b3 100755 --- a/functions.php +++ b/functions.php @@ -28,9 +28,11 @@ add_action( 'widgets_init', 'arphabet_widgets_init' ); * * Grab the top level pages and their sub pages as the main navigation */ -function glm_page_menu($parent = 0, $class = '') +function glm_page_menu($parent = 0, $class = '', $mainOnly = false, $includeHomePage = false) { - $frontPageId = get_option('page_on_front'); + $frontPageId = ($includeHomePage) + ? '' + : get_option('page_on_front'); $parents = array(); $pages = get_pages(array( 'post_type' => 'page', @@ -44,7 +46,7 @@ function glm_page_menu($parent = 0, $class = '') echo ''."\n"; foreach ($pages as $page) { $childs = get_pages('child_of=' . $page->ID); - if (count($childs) > 0) { + if (count($childs) > 0 && !$mainOnly) { echo '
  • '."\n"; echo ''.$page->post_title.''."\n"; echo glm_page_menu($page->ID, 'sub-menu dropdown'); diff --git a/header.php b/header.php index f67970a..75c9d3e 100755 --- a/header.php +++ b/header.php @@ -56,7 +56,7 @@