public function adminBarRender() { global $wp_admin_bar; $thb_theme = thb_theme(); $main_page = $thb_theme->getAdmin()->getMainPage(); if (current_user_can($main_page->getCapability())) { $wp_admin_bar->add_menu(array('parent' => false, 'id' => $main_page->getSlug(), 'title' => $main_page->getTitle(), 'href' => thb_system_admin_url($main_page->getSlug()))); } }
<div class="thb-page-tab <?php echo $tab->getIndex() == 0 ? 'thb-first' : ''; ?> " id="thb-page-tab-<?php echo $tab->getSlug(); ?> " data-slug="<?php echo $tab->getSlug(); ?> " data-page="<?php echo $_GET['page']; ?> "> <form method="post" action="<?php echo thb_system_admin_url($_GET['page']); ?> " enctype="multipart/form-data"> <input type="hidden" name="action" value="<?php echo $tab->getAction(); ?> " /> <input type="hidden" name="THB_nonce" value="<?php echo wp_create_nonce('THB_tab'); ?> " /> <input type="hidden" name="page" value="<?php echo $_GET['page']; ?> " />
/** * Redirect the user to a specific theme page. * * @param string $slug The page slug. * @return void */ public function redirectToThemePage($slug = null) { if (!$slug) { $pages = $this->getPages(); if (empty($pages)) { return; } $page = $pages[0]; $slug = $page->getSlug(); } wp_redirect(thb_system_admin_url($slug)); die; }