From: Anthony Talarico Date: Fri, 14 Oct 2016 13:49:18 +0000 (-0400) Subject: excluding menu items with parents from the off glm_page_menu function for the off... X-Git-Tag: v1.0.15^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=12302f78e242bf75484cc4edf8061f00749d0b7a;p=WP-Themes%2Fpetoskeyarea.git excluding menu items with parents from the off glm_page_menu function for the off canvas menu --- diff --git a/functions.php b/functions.php index 96b77ee..dd2864b 100644 --- a/functions.php +++ b/functions.php @@ -315,15 +315,18 @@ function hm_get_template_part( $file, $template_args = array(), $cache_args = ar return $data; echo $data; } -// add the name of the appearance as the parameter to create a menu based on its subpages +// add the name of the appearance menu as the parameter to create a menu based on its subpages function create_offcanvas_menu($menu_name){ 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); } foreach ( $menu_items as $menu_item ) { - $page_ids[] = get_post_meta( $menu_item->ID, '_menu_item_object_id', true ); + if ( !$menu_item->menu_item_parent ) { + $page_ids[] = get_post_meta( $menu_item->ID, '_menu_item_object_id', true ); + } } + print_r($page_ids); glm_page_menu(0, 'left-off-canvas-list',$page_ids); } ?>