本文整理汇总了PHP中is_admin_bar_showing函数的典型用法代码示例。如果您正苦于以下问题:PHP is_admin_bar_showing函数的具体用法?PHP is_admin_bar_showing怎么用?PHP is_admin_bar_showing使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_admin_bar_showing函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_admin_bar_render
/**
* Render the admin bar to the page based on the $wp_admin_bar->menu member var.
* This is called very late on the footer actions so that it will render after anything else being
* added to the footer.
*
* It includes the action "admin_bar_menu" which should be used to hook in and
* add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
* right before the admin bar is rendered. This also gives you access to the $post global, among others.
*
* @since 3.1.0
*/
function wp_admin_bar_render()
{
global $wp_admin_bar;
if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
return false;
}
/**
* Load all necessary admin bar items.
*
* This is the hook used to add, remove, or manipulate admin bar items.
*
* @since 3.1.0
*
* @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
*/
do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
/**
* Fires before the admin bar is rendered.
*
* @since 3.1.0
*/
do_action('wp_before_admin_bar_render');
$wp_admin_bar->render();
/**
* Fires after the admin bar is rendered.
*
* @since 3.1.0
*/
do_action('wp_after_admin_bar_render');
}
示例2: stormbringer_body_class
/**
* Body Class - Thanks to Theme Hyprid (http://themehybrid.com/)
*/
function stormbringer_body_class($classes = '')
{
global $wp_query;
global $current_user;
// User role
$current_user->ID;
$user = new WP_User($current_user->ID);
// $user->roles
foreach ($user->roles as $role) {
$classes[] = 'role-' . $role;
}
/* Text direction (which direction does the text flow). */
$classes[] = 'wordpress';
$classes[] = get_bloginfo('text_direction');
$classes[] = get_locale();
/* Check if the current theme is a parent or child theme. */
$classes[] = is_child_theme() ? 'child-theme' : 'parent-theme';
/* Multisite check adds the 'multisite' class and the blog ID. */
if (is_multisite()) {
$classes[] = 'multisite';
$classes[] = 'blog-' . get_current_blog_id();
}
/* Date classes. */
$time = time() + get_option('gmt_offset') * 3600;
$classes[] = strtolower(gmdate('\\yY \\mm \\dd \\hH l', $time));
/* Is the current user logged in. */
$classes[] = is_user_logged_in() ? 'logged-in' : 'logged-out';
/* WP admin bar. */
if (is_admin_bar_showing()) {
$classes[] = 'admin-bar';
}
/* Merge base contextual classes with $classes. */
$classes = array_merge($classes, stormbringer_get_context());
/* Singular post (post_type) classes. */
if (is_singular()) {
/* Get the queried post object. */
$post = get_queried_object();
/* Checks for custom template. */
$template = str_replace(array("{$post->post_type}-template-", "{$post->post_type}-", '.php'), '', get_post_meta(get_queried_object_id(), "_wp_{$post->post_type}_template", true));
if (!empty($template)) {
$classes[] = "{$post->post_type}-template-{$template}";
}
/* Post format. */
if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
$post_format = get_post_format(get_queried_object_id());
$classes[] = empty($post_format) || is_wp_error($post_format) ? "{$post->post_type}-format-standard" : "{$post->post_type}-format-{$post_format}";
}
/* Attachment mime types. */
if (is_attachment()) {
foreach (explode('/', get_post_mime_type()) as $type) {
$classes[] = "attachment-{$type}";
}
}
}
/* Paged views. */
if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
$classes[] = 'paged paged-' . intval($page);
}
return $classes;
}
示例3: is_admin_bar_showing
public static function is_admin_bar_showing()
{
if (function_exists('is_admin_bar_showing')) {
return is_admin_bar_showing();
}
return FALSE;
}
示例4: miss_options_toolbar
/**
*
*/
function miss_options_toolbar($el)
{
if (is_admin_bar_showing()) {
global $wp_admin_bar, $wpdb;
$el->add_menu(array('id' => 'my-item', 'title' => 'Theme Options', 'href' => home_url() . '/wp-admin/themes.php?page=miss-options', 'meta' => array('title' => __('Theme Options', MISS_TEXTDOMAIN))));
}
}
示例5: loads
static function loads($hook)
{
if (!self::$add_feedback) {
return;
}
global $wp_admin_bar;
/* CHECK FOR ACTIVE PLUGINS */
$leads_status = FALSE;
$landing_page_status = FALSE;
$cta_status = FALSE;
if (function_exists('is_plugin_active') && is_plugin_active('leads/leads.php')) {
$leads_status = TRUE;
$leads_version_number = defined('WPL_CURRENT_VERSION') ? 'v' . WPL_CURRENT_VERSION : '';
}
if (function_exists('is_plugin_active') && is_plugin_active('landing-pages/landing-pages.php')) {
$landing_page_status = TRUE;
$landing_page_version_number = defined('LANDINGPAGES_CURRENT_VERSION') ? 'v' . LANDINGPAGES_CURRENT_VERSION : '';
}
if (function_exists('is_plugin_active') && is_plugin_active('cta/calls-to-action.php')) {
$cta_status = TRUE;
$cta_number = defined('WP_CTA_CURRENT_VERSION') ? 'v' . WP_CTA_CURRENT_VERSION : '';
}
if ($leads_status == FALSE && $landing_page_status == FALSE && $cta_status == FALSE) {
return;
/* end plugin is */
}
/* Exit if admin bar not there */
if (!is_user_logged_in() || !is_admin_bar_showing()) {
return;
}
/** Show these items only if Inbound Now plugin is actually installed */
if ($leads_status == TRUE || $landing_page_status == TRUE || $cta_status == TRUE) {
}
}
示例6: admin_bar_menu
/**
* Add a 'customize' menu item to the admin bar
*
* This function is attached to the 'admin_bar_menu' action hook.
*
* @since 1.0.0
*/
public function admin_bar_menu($wp_admin_bar)
{
if (current_user_can('edit_theme_options') && is_admin_bar_showing()) {
$wp_admin_bar->add_node(array('parent' => 'bavotasan_toolbar', 'id' => 'customize_theme', 'title' => __('Theme Options', 'tonic'), 'href' => esc_url(admin_url('customize.php'))));
$wp_admin_bar->add_node(array('parent' => 'bavotasan_toolbar', 'id' => 'documentation_faqs', 'title' => __('Documentation & FAQs', 'tonic'), 'href' => 'https://themes.bavotasan.com/documentation', 'meta' => array('target' => '_blank')));
}
}
示例7: build_menu_prefix
/**
* Creates the prefix for the Nav Menu
* @return string
*/
private function build_menu_prefix()
{
$html = '';
//Wrap the whole menu in a container to limit to content width
if ($this->settings->wrap_in_container) {
$html .= "<div class='container'>";
}
//Main Nav Menu settings here - format and fixed type location
$html .= "<nav class='navbar {$this->settings->navbar_format} {$this->settings->navbar_fixed_type}'\n role='navigation'>";
//Move the menu top down if the WP admin bar is displayed
$html .= is_admin_bar_showing() ? $this->fixed_top_spacer_div() : '';
//Inner Nav div and Container or Container-Fluid
$html .= " <div class='navbar-inner'>\n <div class='{$this->settings->class_container}'>";
//Header section for the collapsed button and brand/logo.
$html .= "<div class='navbar-header'>";
//3 icon bar button for the collapsed menu only.
if ($this->settings->display_icon_bar_button) {
$html .= "<button type='button'\n class='navbar-toggle'\n data-toggle='collapse'\n data-target='#{$this->unique_menu_id}'\n aria-expanded='false'>\n <span class='sr-only'>Toggle navigation</span>\n <span class='icon-bar'></span>\n <span class='icon-bar'></span>\n <span class='icon-bar'></span>\n </button>";
}
//Get logo and title visible only for collapsed menu.
$html .= $this->get_display_logo('visible-xs');
$html .= $this->get_display_title('visible-xs');
//close navbar header section
$html .= "</div> <!-- close navbar-header-->";
//Collapse menu target and target id
$html .= "<div class='collapse navbar-collapse'\n id='{$this->unique_menu_id}'>";
//Get logo and title visible only for full menu, includes alignment left/right
// this is deliberately separated from the navbrand above as gives flexibility for edge case of separate left/right align logo/title
$html .= $this->get_display_logo('hidden-xs ' . $this->settings->logo_alignment);
$html .= $this->get_display_title('hidden-xs ' . $this->settings->title_alignment);
//Nav Menu Walker continues here...
return $html;
}
示例8: ubermenu_update_notifier_bar_menu
function ubermenu_update_notifier_bar_menu()
{
global $uberMenu;
if (!$uberMenu->getSettings()->op('update-alerts')) {
return;
}
if (!function_exists('simplexml_load_string')) {
return;
}
global $wp_admin_bar, $wpdb;
if (!is_super_admin() || !is_admin_bar_showing()) {
return;
}
$xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
//21600); // This tells the function to cache the remote call for 21600 seconds (6 hours)
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
// Get plugin data (current version is what we want)
if (!$xml) {
//we can't retrieve the XML file and parse it properly
return;
}
if (version_compare($plugin_data['Version'], $xml->latest) == -1) {
$wp_admin_bar->add_menu(array('id' => 'ubermenu_update_notifier', 'title' => '<span> ' . __('UberMenu', 'ubermenu') . ' <span id="ab-updates">' . __('New Updates', 'ubermenu') . '</span></span>', 'href' => get_admin_url() . 'themes.php?page=uber-menu&updates=1'));
}
}
示例9: admin_bar_init
/**
* Add the hooks to display the asset panel in the admin bar
* @since 0.0.1
*/
public function admin_bar_init()
{
if (!is_super_admin() || !is_admin_bar_showing() || $this->is_wp_login()) {
return;
}
// Add links to the plugin listing on the installed plugins page
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
// Don't bother showing the panel in the admin area
if (is_admin()) {
return;
}
// Enqueue assets for the control panel
add_action('wp_enqueue_scripts', array($this, 'register_assets'));
// Store all assets enqueued in the head
add_action('wp_head', array($this, 'store_head_assets'), 1000);
// Store any new assets enqueued in the footer
add_action('wp_footer', array($this, 'store_footer_assets'), 1000);
// Deregister assets
add_action('wp_head', array($this, 'deregister_assets'), 7);
add_action('wp_footer', array($this, 'deregister_assets'));
// Add the Assets item to the admin bar
add_action('admin_bar_menu', array($this, 'admin_bar_menu'));
// Print the assets panel in the footer
add_action('wp_footer', array($this, 'print_assets_panel'), 1000);
}
示例10: wowslider_admin_bar_menu
function wowslider_admin_bar_menu()
{
global $wp_admin_bar;
if (is_super_admin() && is_admin_bar_showing()) {
$wp_admin_bar->add_menu(array('parent' => 'new-content', 'title' => __('Slider', 'wowslider'), 'href' => admin_url('admin.php?page=wowslider-add-new')));
}
}
示例11: ESSBAdminMenuInit3
function ESSBAdminMenuInit3()
{
global $essb_adminmenu;
if (is_admin_bar_showing()) {
$essb_adminmenu = new ESSBAdminBarMenu3();
}
}
示例12: eab_adminbar_menu_init
function eab_adminbar_menu_init()
{
//if (!is_super_admin() || !is_admin_bar_showing() )
if (is_admin_bar_showing()) {
add_action('admin_bar_menu', 'eab_admin_bar_menu', 1000);
}
}
示例13: init
function init()
{
if ($this->show_in_admin_bar() && is_admin_bar_showing()) {
add_action('admin_bar_menu', array($this, 'dev_admin_menu'));
}
add_filter('debug_bar_panels', array($this, 'init_debug_bar_panels'));
if (self::is_debug_set()) {
// clear transient with url
if (isset($_GET['cdt']) && $_GET['cdt']) {
self::clear_debug_transient();
}
$trans = self::get_debug_transient();
$this->analyze($trans['data'], $trans);
}
//add_action( 'admin_notices', array($this, 'print_persistent_capture' ) );
add_action('current_screen', array($this, 'get_screen'));
wp_enqueue_style('dev-debug', "{$this->uri}/assets/dist/dev-debug.min.css");
wp_enqueue_script('dev-debug', "{$this->uri}/assets/dist/dev-debug.min.js", array('jquery'), false, true);
foreach ($this->hooks['styles'] as $hook) {
add_action($hook, array($this, 'print_styles'), 999);
}
foreach ($this->hooks['scripts'] as $hook) {
add_action($hook, array($this, 'print_scripts'), 999);
}
}
示例14: admin_bar
public function admin_bar()
{
global $wp_admin_bar;
if (is_super_admin() && is_admin_bar_showing()) {
$wp_admin_bar->add_menu(array('parent' => 'new-content', 'id' => 'unoslider', 'title' => __('UnoSlider', 'unoslider'), 'href' => admin_url('admin.php?page=unoslider-new')));
}
}
示例15: env_name_setup
/**
* Add css style for the button
*/
function env_name_setup()
{
if (is_admin_bar_showing()) {
add_action('wp_head', 'env_name_print_style');
add_action('admin_head', 'env_name_print_style');
}
}