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);
}
?>