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/
Related
I have used below action hook to hide fields but it is not working.
remove_action( 'give_cc_form', 'give_get_cc_form' );
can anyone help me to figure out this issue
I am using GiveWP plugin for donation in WordPress site.
GiveWP has a pretty expansive snippet library, and one example shows how you can remove and rearrange fields. This is probably the best place to start from:
https://github.com/impress-org/givewp-snippet-library/blob/master/form-customizations/customize-fieldset-order.php
function give_remove_fieldsets() {
remove_action( 'give_cc_form', 'give_get_cc_form' );
}
add_action( 'init', 'give_remove_fieldsets' );
this actually worked for me
Make sure to run it at init, and you need to add the same priority used in the add_action, if none it uses 10 and the priority can be left blank
add_action('init','remove_actions');
function remove_actions() {
remove_action( 'give_cc_form', 'give_get_cc_form', 1 ); // Replace the priority with the correct one
}
I need to remove sidebar into my woocommerce store.
I have tried with backend in option theme and in each category but resultless.
I tried also:
1.file wp-template-hooks.php
removed--> do_action(..
2.file archive-product.php
removed--> do_action(..
insert in file function.php in theme dir and function.php in woocommerce dir
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
into database there is 2 tables with 2 fields serialised but is a risk change this.
resulless.
I finished the ideas.
Where is saved into db the visibility of sidebar? or the variable?
Can you help me?
Thanks
Ale
I just wanted to update this post for WooCommerce version 3.2.3 - 2017
OK the WooCommerce Plugin includes a folder with all the template files if you want to make changes to the template on a custom theme or child theme you need to copy all of the desired template into a folder called woocommerce in your root theme folder. This will overwrite the plugin templates and will allow for WooCommerce updates with overwriting your custom changes. These templates have all of the do_actions and hooks in the comments so it makes it easy to understand how it's working.
That said WooCommerce has hooks that allow for you to add or remove blocks of code you can check out the API Docs here.
To remove the side bar you need to add this into your functions.php file in your theme setup function
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
Please, add this code to your functions.php
function mb_remove_sidebar() {
return false;
}
add_filter( 'is_active_sidebar', 'mb_remove_sidebar', 10, 2 );
Add to functions.php the following line:
add_action( 'init', function () {
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
} );
You have already integrated WooCommerce in your theme?
If not, try to do this three steps for integration WooCommerce in your theme.
After that, remove get_sidebar(); from your_theme/woocommerce.php
It works fine for me. Screenshot here.
Hope it helps.
Further to #maksim-borodov's answer, I wanted to hide the sidebar conditionally, i.e. only on Product pages. Here's how:
function remove_wc_sidebar_conditional( $array ) {
// Hide sidebar on product pages by returning false
if ( is_product() )
return false;
// Otherwise, return the original array parameter to keep the sidebar
return $array;
}
add_filter( 'is_active_sidebar', 'remove_wc_sidebar_conditional', 10, 2 );
Add to functions.php the following line:
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
I am using GeneratePress (free version), so the other solutions didn't work for me.
This page gave me the answer: https://docs.generatepress.com/article/sidebar-layout/#sidebar-filter
add_filter( 'generate_sidebar_layout', function( $layout ) {
// If we are on a woocommerce page, set the sidebar
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
return 'no-sidebar';
}
// Or else, set the regular layout
return $layout;
} );
This can be done by woocommerce sidebar plugin. If you want to remove by code add this code to functions.php,
if (!class_exists( 'WooCommerce' ) ) {return;}
if(is_cart() || is_checkout() || is_product() || is_shop() || is_account_page()){
?>
<style type="text/css">
#secondary {
display: none;
}
#primary {
width:100%;
}
</style>
<?php
}
}
Here is how to remove the sidebar :-
go to wp-content/plugins/woocommerce
in file single-product.php remove the following code -
<?php
/**
* woocommerce_sidebar hook
*
* #hooked woocommerce_get_sidebar - 10
*/
do_action('woocommerce_sidebar');
?>
next edit the file archive-product.php and remove the following code -
<?php
/**
* woocommerce_sidebar hook
*
* #hooked woocommerce_get_sidebar - 10
*/
do_action('woocommerce_sidebar');
?>
(tip* before deleting this, copy and paste the entire code from this page into a seperate text file on your HD...that way you can always paste the original code back into this folder if anything goes wrong)
After updating to Wordpress 4.3 users can see the admin bar. I use this code to hide it normally, but this is not working anymore in 4.3.
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
Any ideas?
The function current_user_can refers to capabilities or user role names. So try manage_options instead:
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
// 'manage_options' is a capability assigned only to administrators
if (!current_user_can('manage_options') && !is_admin()) {
show_admin_bar(false);
}
}
Instead of using the after_setup_theme action you can also add a filter (prefered for newer WP versions):
add_filter( 'show_admin_bar' , 'handle_admin_bar');
function handle_admin_bar($content) {
// 'manage_options' is a capability assigned only to administrators
// here, the check for the admin dashboard is not necessary
if (!current_user_can('manage_options')) {
return false;
}
}
Here is a 6 lines code nugget that will remove the admin bar for non contributor users :
add_action( 'init', 'fb_remove_admin_bar', 0 );
function fb_remove_admin_bar() {
if (!current_user_can('edit_posts')) { // you can change the test here depending on what you want
add_filter( 'show_admin_bar', '__return_false', PHP_INT_MAX );
}
}
Put that in your function.php file or in your custom plugin.
Thanx all for helping. Eventually the problem was a maintenance plugin. When i disabled this it was working again.
Place the code in your theme's functions.php file
if (!current_user_can('manage_options')) {
add_filter('show_admin_bar', '__return_false');
}
Disable the WordPress Admin Bar Using CSS
You only have to copy and paste the CSS code below in Appearance > Customize > Additional CSS, or your style.css file.
The CSS code to disable the toolbar is:
#wpadminbar { display:none !important;}
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..!!
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/