当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_admin_bar_appearance_menu函数代码示例

本文整理汇总了PHP中wp_admin_bar_appearance_menu函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_admin_bar_appearance_menu函数的具体用法?PHP wp_admin_bar_appearance_menu怎么用?PHP wp_admin_bar_appearance_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_admin_bar_appearance_menu函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store_nodes

 function store_nodes()
 {
     global $wp_admin_bar, $wp_version;
     if ($wp_version < 3.4) {
         return;
     }
     //not needed on 3.3
     if (is_admin() && function_exists('get_current_screen')) {
         $screen = get_current_screen();
         if ('wlb-settings_page_white-label-branding-nav' == $screen->id) {
             //----- add some menu items that only show on frontend
             $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
             // Add the appearance submenu items.
             wp_admin_bar_appearance_menu($wp_admin_bar);
             //-----
         }
     }
     $this->admin_bar_nodes = $wp_admin_bar->get_nodes();
 }
开发者ID:emjayoh,项目名称:bhag,代码行数:19,代码来源:class.wlb_admin_bar.php

示例2: wp_admin_bar_site_menu

/**
 * Add the "Site Name" menu.
 *
 * @since 3.3.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_site_menu($wp_admin_bar)
{
    // Don't show for logged out users.
    if (!is_user_logged_in()) {
        return;
    }
    // Show only when the user is a member of this site, or they're a super admin.
    if (!is_user_member_of_blog() && !is_super_admin()) {
        return;
    }
    $blogname = get_bloginfo('name');
    if (!$blogname) {
        $blogname = preg_replace('#^(https?://)?(www.)?#', '', get_home_url());
    }
    if (is_network_admin()) {
        $blogname = sprintf(__('Network Admin: %s'), esc_html(get_current_site()->site_name));
    } elseif (is_user_admin()) {
        $blogname = sprintf(__('Global Dashboard: %s'), esc_html(get_current_site()->site_name));
    }
    $title = wp_html_excerpt($blogname, 40, '&hellip;');
    $wp_admin_bar->add_menu(array('id' => 'site-name', 'title' => $title, 'href' => is_admin() ? home_url('/') : admin_url()));
    // Create submenu items.
    if (is_admin()) {
        // Add an option to visit the site.
        $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url('/')));
        if (is_blog_admin() && is_multisite() && current_user_can('manage_sites')) {
            $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'edit-site', 'title' => __('Edit Site'), 'href' => network_admin_url('site-info.php?id=' . get_current_blog_id())));
        }
    } else {
        // We're on the front end, link to the Dashboard.
        $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
        // Add the appearance submenu items.
        wp_admin_bar_appearance_menu($wp_admin_bar);
    }
}
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:42,代码来源:admin-bar.php

示例3: wp_admin_bar_site_menu

/**
 * Add the "Site Name" menu.
 *
 * @since 3.3.0
 */
function wp_admin_bar_site_menu($wp_admin_bar)
{
    global $current_site;
    // Don't show for logged out users.
    if (!is_user_logged_in()) {
        return;
    }
    // Show only when the user is a member of this site, or they're a super admin.
    if (!is_user_member_of_blog() && !is_super_admin()) {
        return;
    }
    $blogname = get_bloginfo('name');
    if (empty($blogname)) {
        $blogname = preg_replace('#^(https?://)?(www.)?#', '', get_home_url());
    }
    if (is_network_admin()) {
        $blogname = sprintf(__('Network Admin: %s'), esc_html($current_site->site_name));
    } elseif (is_user_admin()) {
        $blogname = sprintf(__('Global Dashboard: %s'), esc_html($current_site->site_name));
    }
    $title = wp_html_excerpt($blogname, 40);
    if ($title != $blogname) {
        $title = trim($title) . '&hellip;';
    }
    $wp_admin_bar->add_menu(array('id' => 'site-name', 'title' => $title, 'href' => is_admin() ? home_url('/') : admin_url()));
    // Create submenu items.
    if (is_admin()) {
        // Add an option to visit the site.
        $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url('/')));
        // We're on the front end, print a copy of the admin menu.
    } else {
        // Add the dashboard item.
        $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
        // Add the appearance submenu items.
        wp_admin_bar_appearance_menu($wp_admin_bar);
    }
}
开发者ID:sontv1003,项目名称:vtcacademy,代码行数:42,代码来源:admin-bar.php

示例4: wp_admin_bar_blog_front_menu

/**
 * Add the "Blog Name" menu in the front end.
 *
 * @since 3.3.0
 */
function wp_admin_bar_blog_front_menu($wp_admin_bar)
{
    if (!is_user_logged_in()) {
        return;
    }
    $blogname = get_bloginfo('name');
    if (empty($blogname)) {
        $blogname = preg_replace('#^(https?://)?(www.)?#', '', get_home_url());
    }
    $wp_admin_bar->add_menu(array('id' => 'blog-name', 'title' => $blogname, 'href' => admin_url()));
    // Add Dashboard item.
    $wp_admin_bar->add_menu(array('id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url(), 'parent' => 'blog-name'));
    wp_admin_bar_appearance_menu($wp_admin_bar);
}
开发者ID:netconstructor,项目名称:WordPress,代码行数:19,代码来源:admin-bar.php


注:本文中的wp_admin_bar_appearance_menu函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。