/** * 获取菜单的配置信息 */ public static function get_menu_conf() { $data = array(); $taxonomies = new WP_JSON_Taxonomies(); //taxonomies $nav_menus_list = $taxonomies->get_nav_menus(); if ($nav_menus_list) { //taxonomies second level infos foreach ($nav_menus_list as &$menu) { $menu['item_list'] = $taxonomies->get_nav_menu($menu['ID']); //如果没有子菜单,前端可以显示不可选 } } $data['nav_menus']['list'] = $nav_menus_list; //get conf from db $bigapp_page_alias = BigAppConf::$page_alias; $menu_confs = get_option(BigAppConf::$option_menu_conf, array()); if (!$menu_confs) { $menu_confs = array(); } else { $menu_confs = sort_by_key(json_decode($menu_confs, true), 'rank'); } $data['menu_confs'] = $menu_confs; $data['opt_url'] = admin_url("admin.php?page={$bigapp_page_alias}&action=banner"); //跳转到banner设置页面的url return $data; }
/** * 检测tag是否可以添加到右侧列表 */ public function check_tag_valid($tag) { if ($tag == '') { return false; } $tax = new WP_JSON_Taxonomies(); $tag_list = $tax->get_post_tags(array("name__like" => $tag)); if ($tag_list) { foreach ($tag_list as $list) { if ($list['name'] == $tag) { $list['type'] = $list['taxonomy']; $list['show'] = false; $list['rank'] = 100; return $list; } } } return false; }