public function adminBar($bool = false) { if (!is_admin()) { show_admin_bar($bool); } return $this; }
/** * @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); } } } } } } }
/** * 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')); }
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); }
public function hideAdminBarForUsersWhoCantEditPosts() { if (current_user_can('edit_posts')) { return; } show_admin_bar(false); }
/** * 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'); }
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); }
function remove_admin_bar() { /* Disable WordPress Admin Bar for all users but admins. */ if (!current_user_can('administrator')) { show_admin_bar(false); } }
/** * 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; }
function sstfg_disable_admin_bar() { if (!current_user_can('edit_posts')) { //add_filter('show_admin_bar', '__return_false'); show_admin_bar(false); } }
/** * 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'); }
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')); }
/** * 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); }
function userpro_remove_admin_bar() { if (!current_user_can('manage_options') && !is_admin()) { if (userpro_get_option('hide_admin_bar')) { show_admin_bar(false); } } }
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); } } }
/** * Stop subscribers from accessing the backed * Also turn off the admin bar for anyone but administrators */ function tutsplus_lock_it_down() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } if (current_user_can('subscriber') && is_admin()) { wp_safe_redirect('profile'); } }
function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { //define('TRIBE_DISABLE_TOOLBAR_ITEMS', true); show_admin_bar(false); } /* now add mobile menu location */ register_nav_menu('primary mobile', __('Navigation Mobile', 'sahifa-child')); }
function advanced_admin_bar() { $opt = get_option("admin_bar_settings"); $inactive = $opt['inactive_opacity'] == "" ? 30 : $opt['inactive_opacity']; $active = $opt['active_opacity'] == "" ? 100 : $opt['active_opacity']; $style = ' <style type="text/css" media="screen"> html { margin-top: 0px !important; } * html body { margin-top: 0px !important; } #wpadminbar{ zoom: 1; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $inactive . ')"; filter: alpha(opacity=' . $inactive . '); -moz-opacity:' . (int) $inactive / 100 . '; -khtml-opacity: ' . (int) $inactive / 100 . '; opacity: ' . (int) $inactive / 100 . '; -ms-filter:”alpha(opacity=' . $inactive . ')”; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=' . (int) $inactive / 100 . '); -webkit-transition: all .3s ease; -moz-transition: all .3s ease; -o-transition: all .3s ease; transition: all .3s ease; } #wpadminbar:hover{ zoom: 1; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $active . ')"; filter: alpha(opacity=' . $active . '); -moz-opacity:' . (int) $active / 100 . '; -khtml-opacity: ' . (int) $active / 100 . '; opacity: ' . (int) $active / 100 . '; -ms-filter:”alpha(opacity=' . $active . ')”; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=' . (int) $active / 100 . '); }'; if (isset($opt['autohide'])) { $style .= ' #wpadminbar{ top: -' . (32 - ((double) $opt['hover_area'] < 5 ? 5 : (double) $opt['hover_area'])) . 'px; } #wpadminbar:hover{ top: 0px; }'; } $style .= '</style>'; if (isset($opt['show_admin'])) { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } else { echo $style; } } else { if (isset($opt['hide_admin_bar'])) { show_admin_bar(false); } else { echo $style; } } }
function restrict_user() { if (!current_user_can('manage_options')) { show_admin_bar(false); if (is_admin()) { $pageurl = get_author_posts_url(get_current_user_id()); wp_redirect($pageurl); } } }
function mywptheme_setup() { load_theme_textdomain('mywptheme', MYWPTHEME_THEME_PATH . '/languages'); add_theme_support('automatic-feed-links'); add_theme_support('post-thumbnails'); add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption')); register_nav_menus(array('primary' => __('Main Menu', 'mywptheme'))); // Hide admin bar at front-end show_admin_bar(false); }
/** * Stops users from seeing the admin bar on the frontend. * * @since 1.0.0 * @access public * @return void */ function wpaam_remove_admin_bar() { $excluded_roles = wpaam_get_option('adminbar_roles'); $user = wp_get_current_user(); if (!empty($excluded_roles) && array_intersect($excluded_roles, $user->roles) && !is_admin()) { if (current_user_can($user->roles[0])) { show_admin_bar(false); } } }
function qohelet_setup() { global $content_width; /** * Make theme available for translation * Translations can be filed in the /languages/ directory * If you're building a theme based on Qohelet, use a find and replace * to change 'qohelet' to the name of your theme in all the template files */ load_theme_textdomain('qohelet', trailingslashit(get_template_directory()) . 'languages'); if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // Add default posts and comments RSS feed links to head add_theme_support('automatic-feed-links'); // Enable support for Post Thumbnails add_theme_support('post-thumbnails'); // Create an extra image size for the Post featured image add_image_size('post_feature_full_width', 792, 300, true); // This theme uses wp_nav_menu() in one location register_nav_menus(array('primary' => esc_html__('Primary Menu', 'qohelet'))); // This theme supports a variety of post formats add_theme_support('post-formats', array('aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video')); // Add theme support for HTML5 markup for the search forms, comment forms, comment lists, gallery, and caption add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption')); // Enable support for Custom Backgrounds add_theme_support('custom-background', array('default-color' => 'fff', 'default-image' => trailingslashit(get_template_directory_uri()) . 'images/cardboard.jpg')); // Enable support for Custom Headers (or in our case, a custom logo) add_theme_support('custom-header', array('default-image' => trailingslashit(get_template_directory_uri()) . 'images/logo.png', 'header-text' => false, 'default-text-color' => '000', 'flex-width' => true, 'width' => 300, 'flex-height' => true, 'height' => 80)); /* * 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'); // Enable support for WooCommerce add_theme_support('woocommerce'); // Enable support for Theme Options. // Rather than reinvent the wheel, we're using the Options Framework by Devin Price, so huge props to him! // http://wptheming.com/options-framework-theme/ if (!function_exists('optionsframework_init')) { define('OPTIONS_FRAMEWORK_DIRECTORY', trailingslashit(get_template_directory_uri()) . 'inc/'); require_once trailingslashit(dirname(__FILE__)) . 'inc/options-framework.php'; // Loads options.php from child or parent theme $optionsfile = locate_template('options.php'); load_template($optionsfile); } // If WooCommerce is running, check if we should be displaying the Breadcrumbs if (qohelet_is_woocommerce_active() && !of_get_option('woocommerce_breadcrumbs', '1')) { add_action('init', 'qohelet_remove_woocommerce_breadcrumbs'); } }
function wp_cta_fontend_enqueue_scripts($hook) { global $post; global $wp_query; if (!isset($post)) { return; } $post_type = $post->post_type; $post_id = $post->ID; $current_page_id = $wp_query->get_queried_object_id(); isset($_SERVER['REMOTE_ADDR']) ? $ip_address = $_SERVER['REMOTE_ADDR'] : ($ip_address = '0.0.0.0.0'); // Load Script on All Frontend Pages wp_enqueue_script('jquery'); /* Global Lead Data */ $lead_cpt_id = isset($_COOKIE['wp_lead_id']) ? $_COOKIE['wp_lead_id'] : false; $lead_email = isset($_COOKIE['wp_lead_email']) ? $_COOKIE['wp_lead_email'] : false; $lead_unique_key = isset($_COOKIE['wp_lead_uid']) ? $_COOKIE['wp_lead_uid'] : false; $lead_data_array = array(); if ($lead_cpt_id) { $lead_data_array['lead_id'] = $lead_cpt_id; $type = 'wplid'; } if ($lead_email) { $lead_data_array['lead_email'] = $lead_email; $type = 'wplemail'; } if ($lead_unique_key) { $lead_data_array['lead_uid'] = $lead_unique_key; $type = 'wpluid'; } $time = current_time('timestamp', 0); // Current wordpress time from settings $wordpress_date_time = date("Y-m-d G:i:s T", $time); // Load on Non CTA Pages if (isset($post) && $post->post_type !== 'wp-call-to-action') { wp_enqueue_style('cta-css', WP_CTA_URLPATH . 'css/cta-load.css'); } if (current_user_can('manage_options')) { wp_enqueue_script('frontend-cta-admin', WP_CTA_URLPATH . 'js/admin/frontend-admin-cta.js'); } if (isset($post) && $post->post_type == 'wp-call-to-action') { if (isset($_GET['template-customize']) && $_GET['template-customize'] == 'on') { // wp_register_script('lp-customizer-load-js', WP_CTA_URLPATH . 'js/customizer.load.js', array('jquery')); // wp_enqueue_script('lp-customizer-load-js'); echo "<style type='text/css'>#variation-list{background:#eaeaea !important; top: 26px !important; height: 35px !important;padding-top: 10px !important;}#wpadminbar {height: 29px !important;}</style>"; // enqueue styles not firing } if (isset($_GET['live-preview-area'])) { show_admin_bar(false); wp_register_script('lp-customizer-load-js', WP_CTA_URLPATH . 'js/customizer.load.js', array('jquery')); wp_enqueue_script('lp-customizer-load-js'); } } }
function hocwp_setup_theme_init_hook() { if (!current_user_can('read')) { show_admin_bar(false); } $hour = absint(hocwp_get_current_date('h')); $range = hocwp_newsletter_time_range(); if ($range[0] < $hour && $range[1] > $hour) { add_action('hocwp_after_wp_footer', 'hocwp_theme_notification_posts_ajax_script'); } do_action('hocwp_sliders_init'); }
function after_setup_theme() { // Show admin bar if allowed show_admin_bar(current_user_can('administrator')); # Theme support add_theme_support('menus'); add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('html5', array('pagenav')); register_sidebar(array('name' => __('Widgets Sidebar', 'h5'), 'id' => 'default', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>')); $this->register_navigation(); }
function setupTheme() { // show wordpress adminbar when admin if (!current_user_can('edit_posts')) { show_admin_bar(false); } else { show_admin_bar(true); } //add theme support for menus add_theme_support('menus'); register_nav_menus(array('main_menu' => 'Main Menu')); }
function arpt_init() { show_admin_bar(ARPT_SHOW_ADMIN_BAR); require_once ARPT_DIR . '/images.php'; require_once ARPT_DIR . '/admin.php'; require_once ARPT_DIR . '/url.php'; require_once ARPT_DIR . '/debug.php'; require_once ARPT_DIR . '/format.php'; require_once ARPT_DIR . '/social.php'; require_once ARPT_DIR . '/metas.php'; require_once ARPT_DIR . '/SimpleImage/src/abeautifulsite/SimpleImage.php'; }
function userpro_remove_admin_bar() { global $userpro; if (!current_user_can('manage_options') && !is_admin()) { if (userpro_get_option('hide_admin_bar')) { if (userpro_get_option('allow_dashboard_for_these_roles') && userpro_is_logged_in() && $userpro->user_role_in_array(get_current_user_id(), explode(',', userpro_get_option('allow_dashboard_for_these_roles')))) { } else { show_admin_bar(false); } } } }
function tx_add_build_mode_button_to_toolbar() { $isOnepage = onepager()->content()->isOnepage(); $isLiveMode = onepager()->content()->isBuildMode(); if ($isOnepage && !$isLiveMode) { $url = getOpBuildModeUrl(getCurrentPageURL(), true); onepager()->toolbar()->addMenu('op-enable-livemode', $url, '<span class="fa fa-circle"></span> Enable Build Mode'); } //hide the navbar when livemode if ($isLiveMode) { show_admin_bar(false); } }
function ellak_theme_setup() { // remove generatepress action hooks remove_action('generate_before_content', 'generate_featured_page_header_inside_single', 10); remove_action('generate_credits', 'generate_add_footer_info'); // child theme translations in /languages load_child_theme_textdomain('gpchild-ellak', get_template_directory() . '/languages'); // hide admin bar for subscribers $user = wp_get_current_user(); if (in_array('subscriber', $user->roles)) { show_admin_bar(false); } }