本文整理汇总了PHP中show_admin_bar函数的典型用法代码示例。如果您正苦于以下问题:PHP show_admin_bar函数的具体用法?PHP show_admin_bar怎么用?PHP show_admin_bar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_admin_bar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminBar
public function adminBar($bool = false)
{
if (!is_admin()) {
show_admin_bar($bool);
}
return $this;
}
示例2: init
/**
* @method init
*/
public static function init()
{
global $pagenow;
$settings = HiddenWPAdminSettings::get_all();
$login = in_array($pagenow, array('wp-login.php', 'wp-register.php'));
$signup = $pagenow == 'wp-signup.php';
// Not enabled.
if (empty($settings['enabled'])) {
return;
} else {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'logout') {
return;
} else {
if (is_admin()) {
self::redirect_admin();
} else {
if ($login && !empty($settings['redirect_login_page'])) {
self::redirect_login();
} else {
if ($signup && !empty($settings['redirect_signup_page'])) {
self::redirect_signup();
} else {
if (!current_user_can($settings['capability'])) {
show_admin_bar(false);
}
}
}
}
}
}
}
示例3: nepworkshop1_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function nepworkshop1_setup()
{
// Add default posts and comments RSS feed Links to head.
add_theme_support('automatic-feed-links');
/*
* Let WordPress manage the document title
*/
add_theme_support('title-tag');
/**
* Enable support for Post Thumbinails on posts and pages.
*/
add_theme_support('post-thumbnails');
set_post_thumbnail_size(1200, 9999);
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(array('top_menu' => __('Menu górne', 'nepworkshop1'), 'footer_menu' => __('Menu dolne', 'nepworkshop1')));
/**
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
/*
* Enable support for Post Formats
*/
add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'));
/*
* This theme styles the visual editor to resemble the theme style,
* specyfically font, colors, icons, and column width.
*/
add_editor_style(array('css/editor-style.css'));
/**
* Set shown admin bar in front
*/
show_admin_bar(get_theme_mod('show_admin_bar'));
}
示例4: __construct
public function __construct()
{
// custom post types
add_action("pe_theme_custom_post_type", array(&$this, "pe_theme_custom_post_type"));
// wp_head stuff
add_action("pe_theme_wp_head", array(&$this, "pe_theme_wp_head"));
// google fonts
add_filter("pe_theme_font_variants", array(&$this, "pe_theme_font_variants_filter"), 10, 2);
// menu
add_filter("wp_nav_menu_objects", array(&$this, "wp_nav_menu_objects_filter"), 10, 2);
// social links
add_filter("pe_theme_social_icons", array(&$this, "pe_theme_social_icons_filter"));
add_filter("pe_theme_content_get_social_link", array(&$this, "pe_theme_content_get_social_link_filter"), 10, 4);
// comment submit button class
add_filter("pe_theme_comment_submit_class", array(&$this, "pe_theme_comment_submit_class_filter"));
// use prio 30 so gets executed after standard theme filter
add_filter("the_content_more_link", array(&$this, "the_content_more_link_filter"), 30);
// hide the admin bar (known to cause issues with the theme when enabled)
show_admin_bar(false);
// custom homepage meta js
add_action('admin_enqueue_scripts', array($this, 'pe_theme_visia_custom_meta_js'));
// remove junk from project screen
add_action('pe_theme_metabox_config_project', array(&$this, 'pe_theme_visia_metabox_config_project'), 200);
// add featured image to testimonial
add_action('init', array(&$this, 'pe_theme_visia_testimonial_supports'), 200);
// shortcodes
add_filter("pe_theme_shortcode_columns_mapping", array(&$this, "pe_theme_shortcode_columns_mapping_filter"));
add_filter("pe_theme_shortcode_columns_options", array(&$this, "pe_theme_shortcode_columns_options_filter"));
// portfolio
add_filter("pe_theme_filter_item", array(&$this, "pe_theme_project_filter_item_filter"), 10, 4);
}
示例5: hideAdminBarForUsersWhoCantEditPosts
public function hideAdminBarForUsersWhoCantEditPosts()
{
if (current_user_can('edit_posts')) {
return;
}
show_admin_bar(false);
}
示例6: calibrefx_init_mobile_site
/**
* If mobile site is enable and there is a mobile template, then display mobile layout on mobile
*/
function calibrefx_init_mobile_site()
{
global $calibrefx;
//Register mobile menu
register_nav_menus(array('mobile' => apply_filters('mobile_menu_text', __('Mobile Navigation Menu', 'calibrefx'))));
if (is_admin() or !wp_is_mobile()) {
return;
}
remove_theme_support('calibrefx-footer-widgets');
remove_theme_support('calibrefx-header-right-widgets');
//Disable wp admin bar
show_admin_bar(false);
add_filter('body_class', 'calibrefx_mobile_site_body_class');
add_filter('wrapper_class', 'calibrefx_mobile_wrapper_class');
add_filter('wrapper_attr', 'calibrefx_mobile_wrapper_attr');
remove_action('calibrefx_after_header', 'calibrefx_do_nav');
remove_action('calibrefx_after_header', 'calibrefx_do_subnav', 15);
add_action('calibrefx_before_wrapper', 'calibrefx_do_top_mobile_nav');
add_action('calibrefx_after_wrapper', 'calibrefx_do_mobile_footer', 100);
add_filter('template_include', 'calibrefx_get_mobile_template');
if (file_exists(CHILD_MOBILE_URI . '/functions.php')) {
load_template(CHILD_MOBILE_URI . '/functions.php');
}
$calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_breadcrumbs', 10);
$calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_notification', 20);
$calibrefx->hooks->remove('calibrefx_sidebar', 'calibrefx_do_sidebar');
$calibrefx->hooks->remove('calibrefx_sidebar_alt', 'calibrefx_do_sidebar_alt');
$calibrefx->hooks->remove('calibrefx_after_post_content', 'calibrefx_do_author_box_single', 20);
$calibrefx->hooks->remove('calibrefx_footer', 'calibrefx_footer_area', 10);
//On mobile there is no sidebar
add_filter('calibrefx_site_layout', 'calibrefx_layout_full_width');
}
示例7: nwclean_setup
function nwclean_setup()
{
/*
* Add the main navigation menu
*/
if (function_exists('register_nav_menu')) {
register_nav_menu('Main navigation menu', 'Main navigation menu');
}
/*
* Adding expert capabilities
*/
add_post_type_support('page', 'excerpt');
/*
* Localising wordpress
*/
$lang = TEMPLATEPATH . '/lang';
load_theme_textdomain('nw-clean', $lang);
/*
* Adding support for post thumbnails
*/
add_theme_support('post-thumbnails');
/*
* disabling adming bar
*/
show_admin_bar(false);
}
示例8: remove_admin_bar
function remove_admin_bar()
{
/* Disable WordPress Admin Bar for all users but admins. */
if (!current_user_can('administrator')) {
show_admin_bar(false);
}
}
示例9: template_redirect
/**
* Handle requests for form iframes.
*
* @since 1.0.0
*/
public function template_redirect()
{
global $wp;
if (empty($wp->query_vars['gfiframe']) || 'gfembed' != $wp->query_vars['gfiframe'] && 'gfembed.php' != $wp->query_vars['gfiframe']) {
return;
}
$form_id = null;
if (!empty($_GET['f'])) {
$form_id = absint($_GET['f']);
} else {
// The request needs an 'f' query arg with the form id.
wp_die(esc_html__('Invalid form id.', 'gravity-forms-iframe'));
}
$form = GFFormsModel::get_form_meta($form_id);
$settings = $this->addon->get_form_settings($form);
// Make sure the form can be embedded.
if (empty($settings['is_enabled']) || !$settings['is_enabled']) {
wp_die(esc_html__('Embedding is disabled for this form.', 'gravity-forms-iframe'));
}
// Disable the toolbar in case the form is embedded on the same domain.
show_admin_bar(false);
require_once GFCommon::get_base_path() . '/form_display.php';
// Settings may be overridden in the query string (querystring -> form settings -> default).
$args = wp_parse_args($_GET, array('dt' => empty($settings['display_title']) ? false : (bool) $settings['display_title'], 'dd' => empty($settings['display_description']) ? false : (bool) $settings['display_description']));
// @todo Need to convert query string values to boolean.
$display_title = (bool) $args['dt'];
$display_description = (bool) $args['dd'];
unset($args);
unset($settings);
// Templates can be customized in parent or child themes.
$templates = array('gravity-forms-iframe-' . $form_id . '.php', 'gravity-forms-iframe.php');
$template = gfiframe_locate_template($templates);
include $template;
exit;
}
示例10: sstfg_disable_admin_bar
function sstfg_disable_admin_bar()
{
if (!current_user_can('edit_posts')) {
//add_filter('show_admin_bar', '__return_false');
show_admin_bar(false);
}
}
示例11: preview_theme
/**
* Replaces core function to start preview theme output buffer.
*/
static function preview_theme()
{
// are we previewing?
if (!isset($_GET['template']) || !wp_verify_nonce($_GET['preview_ctc'])) {
return;
}
// can user preview?
if (!current_user_can('switch_themes')) {
return;
}
// hide admin bar in preview
if (isset($_GET['preview_iframe'])) {
show_admin_bar(false);
}
// sanitize template param
$_GET['template'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['template']);
// check for manipulations
if (validate_file($_GET['template'])) {
return;
}
// replace future get_template calls with preview template
add_filter('template', 'ChildThemeConfiguratorPreview::preview_theme_template_filter');
if (isset($_GET['stylesheet'])) {
// sanitize stylesheet param
$_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
// check for manipulations
if (validate_file($_GET['stylesheet'])) {
return;
}
// replace future get_stylesheet calls with preview stylesheet
add_filter('stylesheet', 'ChildThemeConfiguratorPreview::preview_theme_stylesheet_filter');
}
// swap out theme mods with preview theme mods
add_filter('pre_option_theme_mods_' . get_option('stylesheet'), 'ChildThemeConfiguratorPreview::preview_mods');
}
示例12: cornerstone_theme_support
function cornerstone_theme_support()
{
// Add language support
load_theme_textdomain('Cornerstone', get_template_directory() . '/languages');
// Add menu support
add_theme_support('menus');
// Let WordPress manage the document title
add_theme_support('title-tag');
// Add post thumbnail support: http://codex.wordpress.org/Post_Thumbnails
add_theme_support('post-thumbnails');
// Add theme support for Automatic Feed Links
add_theme_support('automatic-feed-links');
// Add post formats support: http://codex.wordpress.org/Post_Formats
add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));
// Add widget live previews support
add_theme_support('widget-customizer');
// Disable the admin bar, set to true if you want it to be visible.
show_admin_bar(FALSE);
// Declare Woocommerce support
add_theme_support('woocommerce');
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'widgets'));
}
示例13: setup_theme
/**
* Start preview and customize theme.
*
* Check if customize query variable exist. Init filters to filter the current theme.
*
* @since 3.4.0
*/
public function setup_theme()
{
if (!isset($_REQUEST['customize']) || 'on' != $_REQUEST['customize']) {
return;
}
$this->start_previewing_theme();
show_admin_bar(false);
}
示例14: userpro_remove_admin_bar
function userpro_remove_admin_bar()
{
if (!current_user_can('manage_options') && !is_admin()) {
if (userpro_get_option('hide_admin_bar')) {
show_admin_bar(false);
}
}
}
示例15: remove_admin_bar_when_developing
function remove_admin_bar_when_developing()
{
if (defined('WP_DEBUG') && true === WP_DEBUG) {
if (is_user_logged_in() && current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
}