Anyone know how to remove the admin navigation links from the frontend? I've built a custom theme and when I am logged in to WordPress, WordPress is appending the admin nav bar somewhere.
The admin bar?
Go to Users > Your Profile > Show Admin Bar. Here you can disable it from your theme. If you want to completely disable (remove) it, use one of various plugins, like this.
Or you can remove it by default in functions.php.
/* Disable the Admin Bar. */
add_filter( 'show_admin_bar', '__return_false' );
<?php function yoast_hide_admin_bar_settings() { ?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
<?php }
function yoast_disable_admin_bar() {
add_filter( 'show_admin_bar', '__return_false' );
add_action( 'admin_print_scripts-profile.php',
'yoast_hide_admin_bar_settings' );
}
add_action( 'init', 'yoast_disable_admin_bar' , 9 );
Thanks to Yoast (http://yoast.com/disable-wp-admin-bar/)
Just this alone in the functions.php works for me.
// Remove Admin Bar Front End
add_filter('show_admin_bar', '__return_false');
For wordpress 3.4.2, none of these workarounds should work. I have sorted out a very simple trick to hide the admin bar!
Just after you call the wp_head(), place this style declaration:
<style>
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
</style>
It involves no modification to the functions or whatever. Just plain old css!!
I hope it solves the Googler's problem in near future :-)
Put this in your functions.php:
/* Disable WordPress Admin Bar for all users but admins. */
if(!current_user_can("manage_options")){
show_admin_bar(false);
}
You can do this by plugin, link below:
http://wordpress.org/plugins/global-admin-bar-hide-or-remove/
Related
i want to remove an menu item from admin bar , tried the following code
add_action( 'admin_menu', 'remove_admin_menu_items', 999 );
function remove_admin_menu_items() {
remove_menu_page('admin.php?page=litespeed&LSCWP_CTRL=purge&LSCWP_NONCE=ccd23d492e&litespeed_type=purge_all_lscache' );
}
unfortunately it doesn't work ! I have attached a screenshot of menu I want to remove
I like to hide the menu using the child theme function.php code.
Plugin author posts the following:
The best way to hide our menu is by CSS. For top icon in adminbar, use
.litespeed-top-toolbar {display:none}. It can be done by using 3rd party plugin like https://wordpress.org/plugins/add-admin-css/ or
add_action('admin_head', 'hide_litespeed_icon');
function hide_litespeed_icon() {
echo '<style>.litespeed-top-toolbar {display:none}</style>';
}
into your theme’s functions.php
Alternatively, try adding the following code to functions.php:
function remove_lscwp_admin_menu($wp_admin_bar) {
$wp_admin_bar->remove_node('litespeed-menu');
}
add_action('admin_bar_menu', 'remove_lscwp_admin_menu', 999);
i'm trying to remove the page title from my woocommerce shop page. If i use this css the page title is removed from all pages, this is not what i want.
.page-heading h1 {display: none;}
So i started looking for a page-id, but it seems the shop is a post, so i used postid of my page
.postid-15169 .page-heading h1 {display: none;}
but this doesn't work at all
i also tried to put this is my functions.php
add_filter( 'woocommerce_page_title', false);
But this doesn't do anything either. I guess it's not the shop title i'm needing to remove, just the page title.
Any idea what i can do to remove the title for this page only ?
you can find the page here: https://goo.gl/5LNwRR
I added a ccs code:
.page-title-shop h1 {
display: none;
}
It worked for Woocommerce 3.2.x
Instead of using css, you can use woocommerce filter to get the job done.
function wc_hide_page_title()
{
if( !is_shop() ) // is_shop is the conditional tag
return true;
}
add_filter( 'woocommerce_show_page_title', 'wc_hide_page_title' );
You can remove titles from all woocommerce pages. Here is a blog post about this.
I wanted to remove the cart icon from my nav bar using woocommerce. There did not seem to be a setting in the admin to do that.
I used this code
function remove_nav_cart_link () {
remove_action( 'woo_nav_inside', 'woo_add_nav_cart_link', 20);
}
add_action( 'after_setup_theme', 'remove_nav_cart_link' );
The setting is under WooThemes -> WooCommerce -> Header Cart Link
for me the following solution worked but nothing else
Just added the following code in Theme's custom css
Appearance>Themes>Your theme>Custom CSS
#top .wc-nav li.cart {
display: none !important;}
#top .wc-nav li.checkout{
display: none !important;}
I don't use WooTheme, just the WooCommerce plugin and the header cart still appeared in my premium theme, so instead of disabling it by a function I just used the following CSS code in my child theme..
#Top_bar a#header_cart { display:none }
Go to \wamp64\www\....\wp-content\themes\yourtheme\includes\header-top-bar-right
Find line WooCommerce Cart
Comment the line out:
echo '<a id="header_cart" href="'. $woocommerce->cart->get_cart_url() .'"><i class="'. $show_cart .'"></i><span>'. $woocommerce->cart->cart_contents_count .'</span></a>';
Go to wp-content/themes/yourtheme/inc/woocommerce/yourthemename-woocommerce-template-hook
search for
add_action( 'storefront_header', 'storefront_product_search', 40 );
add_action( 'storefront_header', 'storefront_header_cart', 60 );
comment these 2 lines..!!
I integrated option tree in my template.
I want to hide OptionTree menu item from users. How to remove Option Tree menu item in admin page?
Add this code to your theme's functions.php:
// Remove Option Tree Settings Menu
add_filter( 'ot_show_pages', '__return_false' );
That will remove the Option Tree admin menu.
Here is another solution.
function remove_ot_menu () {
remove_menu_page( "ot-settings" ); } add_action( 'admin_menu', 'remove_ot_menu' );
I know i'm late to the party but since i got to find
a solution (for an old website i restructering) i tought
i might share "a softer" solution.
2 steps
1. We ad the current user id to the admin body class
2. We add a css to hide the menu except for the intended user.
User id in the body class
/*********************************************
** CUSTOM BODY CLASS
*********************************************/
add_filter('admin_body_class', 'custom_admin_body_class');
function custom_admin_body_class($classes){
$cuserid = get_current_user_id();
return $classes. 'user-'.$cuserid;
}
Add the desired css to anytype of css loaded to wp-admin
** replace user-[number] with yours*
.wp-admin:not(.user-1) #toplevel_page_ot-settings {display: none;}
If your not loading any css to wp-admin you can use this
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>.wp-admin:not(.user-1) #toplevel_page_ot-settings {display: none;}</style>';
}
I want to hide wordpress "please notify the site administrator" message from Dashboard.
The message is:
WordPress 3.5.1 is available! Please notify the site administrator.
HTML Code:
<div class="update-nag">WordPress 3.5.1 is available! Please notify the site administrator.</div>
So, i have added a css like this to hide the message but the this is not working!Here is the css:
.update-nag{
display: none;}
Any idea?
you can sue this module found from Prijm enable the module, will do the job:
Hide Update Reminder Message
Place the below code in your theme functions.php file.
Just put this simple code in your functions.php and the update message will be hidden.
function hideUpdateNag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
add_action('admin_menu','hideUpdateNag');
Try:
#update-nag, .update-nag{
display: none;
}
add_action('admin_menu','wphidenag');
2
function wphidenag() {
3
remove_action( 'admin_notices', 'update_nag', 3 );
4
}
Try this
Just put this simple code in your functions.php and the update message will be hidden.
function hideUpdateNag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
add_action('admin_menu','hideUpdateNag');
As the admin, I wanted to see the message, but I wanted it hidden for other users. I did this:
function hideUpdateNag() {
// if not an administrator
if ( !current_user_can('update_core') ) {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action('admin_menu','hideUpdateNag');
WordPress Dashboard (admin world) items cannot be updated using CSS in the Customizer. That only affects front-end CSS. You must use functions, or a plugin/functions combination.
See this article for a solution that doesn't involve hacking functions in WP:
https://chriseller.com/how-to-remove-items-from-the-wordpress-admin-top-bar/