function thb_system_admin_url($slug) { if (thb_system_is_production()) { $basepage = 'admin'; } else { $basepage = 'themes'; } return admin_url('/' . $basepage . '.php?page=' . $slug); }
/** * Register all the defined theme's administration pages. * * @return void **/ public function registerPages() { if (!empty($this->_pages)) { $menu_image = null; $i = 0; foreach ($this->_pages as $page) { $page_title = $page->getTitle(); $page_slug = $page->getSlug(); $page_capability = $page->getCapability(); $page_handler = array($page, 'render'); if (thb_system_is_production()) { if ($i == 0) { add_menu_page($page_title, $page_title, $page_capability, $page_slug, $page_handler, $menu_image, 58); add_submenu_page($page_slug, $page_title, $page_title, $page_capability, $page_slug, $page_handler); $master_page_slug = $page_slug; $i++; } else { add_submenu_page($master_page_slug, $page_title, $page_title, $page_capability, $page_slug, $page_handler); } } else { add_theme_page($page_title, $page_title, $page_capability, $page_slug, $page_handler); } } } }