<?php
register_nav_menus(array(
- 'top-bar' => 'Site Navigation',
+ 'boards' => 'boards-committees',
+ 'departments' => 'departments-services',
+ 'township' => 'township-resources',
+ 'calendar' => 'township-calendar',
'mobile-menu' => 'Off Canvas',
'alt-menu' => "How Do I...",
-
));
-if ( ! function_exists( 'glm_theme_members_only' ) ) {
- function glm_theme_members_only($location) {
- echo '<ul class="members-only">';
- echo glm_theme_top_bar( $location );
- echo '</ul>';
- }
-}
/**
* Top Bar
*/
if ( ! function_exists( 'glm_theme_top_bar' ) ) {
- function glm_theme_top_bar($location) {
- wp_nav_menu(array(
- 'container' => false, // remove nav container
- 'container_class' => '', // class of container
- 'menu' => '', // menu name
- 'menu_class' => '', // adding custom nav class
- 'theme_location' => $location, // where it's located in the theme
- 'before' => '', // before each link <a>
- 'after' => '', // after each link </a>
- 'link_before' => '', // before each link text
- 'link_after' => '', // after each link text
- 'depth' => 2, // limit the depth of the nav
- 'fallback_cb' => false, // fallback function (see below)
- 'walker' => new Glm_Theme_Top_Bar_Walker()
- ));
- }
+ function glm_theme_top_bar() {
+ echo '<ul>';
+ echo glm_get_top_bar_nav_menu( 'boards' );
+ echo glm_get_top_bar_nav_menu( 'departments' );
+ echo glm_get_top_bar_nav_menu( 'calendar' );
+ echo glm_get_top_bar_nav_menu( 'township' );
+ echo '</ul>';
+ }
+}
+/**
+ * Alt Menus
+ */
+if ( ! function_exists( 'glm_theme_menus' ) ) {
+ function glm_theme_menus($location) {
+ echo '<ul>';
+ echo glm_get_top_bar_nav_menu( $location );
+ echo '</ul>';
+ }
+}
+
+function glm_get_top_bar_nav_menu( $theme_location )
+{
+ $menu = wp_nav_menu(array(
+ 'echo' => false, // don't echo
+ 'container' => false, // remove nav container
+ 'container_class' => '', // class of container
+ 'menu' => '', // menu name
+ 'menu_class' => '', // adding custom nav class
+ 'theme_location' => $theme_location, // where it's located in the theme
+ 'before' => '', // before each link <a>
+ 'after' => '', // after each link </a>
+ 'link_before' => '', // before each link text
+ 'link_after' => '', // after each link text
+ 'depth' => 2, // limit the depth of the nav
+ 'fallback_cb' => false, // fallback function (see below)
+ 'walker' => new Glm_Theme_Top_Bar_Walker()
+ ));
+ return preg_replace( array( '%^<ul[^>]*>%', '%</ul>$%' ), '', $menu );
}
+
/**
* Mobile off-canvas
*/
* @return void
*/
function glm_side_menu($mobile = false) {
+
global $post;
+
$sideMenu = $allMenu = $pageMenuId = array();
- if (($locations = get_nav_menu_locations()) && isset($locations['top-bar'])) {
- $menu = wp_get_nav_menu_object($locations['top-bar']);
+
+// echo $post->ID;
+// if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-1'])) {
+// $menu = wp_get_nav_menu_object($locations['top-bar-1']);
+// }
+ if(is_page(195) || 195 == $post->post_parent || is_in_tree(195)){
+ if (($locations = get_nav_menu_locations()) && isset($locations['boards'])) {
+ $menu = wp_get_nav_menu_object($locations['boards']);
+ }
+ }
+
+ if(is_page(197) || 197 == $post->post_parent || is_in_tree(197)){
+ if (($locations = get_nav_menu_locations()) && isset($locations['departments'])) {
+ $menu = wp_get_nav_menu_object($locations['departments']);
+ }
+ }
+
+ if(is_page(199) || 199 == $post->post_parent || is_in_tree(199)){
+ if (($locations = get_nav_menu_locations()) && isset($locations['calendar'])) {
+ $menu = wp_get_nav_menu_object($locations['calendar']);
+ }
+ }
+ if(is_page(201) || 201 == $post->post_parent || is_in_tree(201)){
+ if (($locations = get_nav_menu_locations()) && isset($locations['township'])) {
+ $menu = wp_get_nav_menu_object($locations['township']);
+ }
+
+ }
+
$menu_items = wp_get_nav_menu_items($menu->term_id);
foreach ((array) $menu_items as $key => $menu_item) {
$sideMenu[$menu_item->menu_item_parent][] = $menu_item;
// If the first element is title [Tabs] then this is a uber menu
// custom item and we need to get the subs under that menu item
// instead ($sideMenu[$subs[0]->ID])
- if ($subs[0]->title == '[Tabs]') {
- $subs = $sideMenu[$subs[0]->ID];
- }
+// if ($subs[0]->title == '[Tabs]') {
+// $subs = $sideMenu[$subs[0]->ID];
+// }
} else if ($thisPageMenuParent) {
$pageHead = $allMenu[$thisPageMenuParent];
// get the subs for $thisPageMenuParent
// get Main level
$subs = $sideMenu[0];
}
- }
+
if ($mobile) {
echo '<ul>';
echo '<li><a href="'.get_bloginfo('url').'">Home</a></li>';
if ($pageHead->target) {
echo ' target="'.$pageHead->target.'"';
}
- echo '>'.strip_tags($pageHead->title).'</a><ul>';
+ echo '>'.$pageHead->title.'</a><ul>';
} else {
- echo '<h4><a href="'.$pageHead->url.'"';
+ echo '<h1><a href="'.$pageHead->url.'"';
if ($pageHead->target) {
echo ' target="'.$pageHead->target.'"';
}
- echo '>'.strip_tags($pageHead->title).'</a></h4>';
+ echo '>'.$pageHead->title.'</a></h1>';
echo '<ul>';
}
foreach ($subs as $menu_item) {
if ($menu_item->target) {
echo ' target="'.$menu_item->target.'"';
}
- echo '>'.strip_tags($menu_item->title) .'</a></li>';
+ echo '>'.$menu_item->title.'</a></li>';
}
if ($mobile) {
- echo '</ul>';
+ echo '</ul>';
}
echo '</ul>';
-
}
-