setup_hooks(); } protected function setup_hooks(){ /** * Action And Filter */ add_action('init', [$this, 'register_menus' ]); } public function register_menus(){ register_nav_menus( [ 'ak_header_menu' => esc_html__('Header Menu', 'atlantisak'), 'ak_footer_menu' => esc_html__('Footer Menu', 'atlantisak') ], ); } public function get_menu_id($location){ //Get All The Location $locations = get_nav_menu_locations( ); //Get Obejct Id By Loaction $menu_id = $locations[$location]; return ! empty($menu_id) ? $menu_id : ''; } public function get_theme_child_menus_item($menu_array, $parent_id){ $child_menu = []; if(! empty ($menu_array) && is_array($menu_array)){ foreach($menu_array as $menus){ if(intval($menus->menu_item_parent) === $parent_id){ array_push($child_menu, $menus); } } } return $child_menu; } }