I have been trying to get this down all day and it is driving me crazy. I know it should be possible using display: none;
I am trying to remove the "Refund Manually" Button
Try this in your functions.php
add_action('admin_head', 'remove_manual_refunds');
function remove_manual_refunds() {
echo '<style>
.do-manual-refund {
display: none !important;
}
</style>';
}
Related
I'm simply trying to hide the login button after user has logged into the site. I've tried writing the custom css in various ways, including the main two below. Action still not working. Please help me to understand what I'm doing wrong.
.logged-in .main-header-menu .login-link{
display: none;
}
.logged-in .main-header-menu .menu-link, .ast-header-custom-item a{
color: var( --e-global-color-primary );
}
you can use this simple code in your functions.php
<?php
add_action( 'init', function () {
if ( is_user_logged_in() ) {
?>
<style>
/** please use the exact call of login button, you can verify class by changing button color **/
.logged-in .main-header-menu .login-link{
display: none;
}
</style>
<?php
}
});
?>
I have a membership site and need prices hidden until the user is logged in. How can I adjust this so prices are hidden only for users who are NOT logged in?
.imagemapper-wrapper .my_product_price { display:none !important; }
Currently prices are hidden from everyone.
CSS only option:
.imagemapper-wrapper .my_product_price {
display: none;
}
.logged-in .imagemapper-wrapper .my_product_price {
display: inherit;
}
One way you can do this is with the wp_head hook. In the hook you can echo the style if a user is logged in with is_user_logged_in(). See below:
<?php
// functions.php
add_action('wp_head', function(){
if (is_user_logged_in()) {
echo '<style>.imagemapper-wrapper .my_product_price { display:none !important; }</style>';
}
});
Another option is to use a custom css classname:
// functions.php
add_filter('body_class', function($classlist) {
// add custom css class to body element if user is logged in
if (is_user_logged_in()) {
$classlist[] = 'user-is-loggedin';
}
return $classlist;
});
Then is your css use the new classname:
// your-stylesheet.css
.imagemapper-wrapper .my_product_price { display:none; }
.user-is-loggedin .imagemapper-wrapper .my_product_price { display:block !important; }
If you want to use CSS instead of removing the pricing unless the user is logged in, use the wp_head filter. Put this in your functions.php file:
add_action('wp_head', static function() {
if ( ! is_user_logged_in() ) {
echo "<style>.imagemapper-wrapper .my_product_price { display:none !important;}</style>";
}
}
This uses is_user_logged_in() function to test if the user is logged in. If the user is not logged in, print this style in your header.
So I ended up merging two answers together. display: inherit wasn't working so I tried block !important instead and it worked like a charm. Thank you all for your advice and suggestions. I am now able to hide both the price and add to cart buttons when a user is NOT logged and show them when they are! I was beyond excited when I finally got this to work. Thank you all!
#mega_main_menu>.menu_holder>.menu_inner>ul>li.default_dropdown .mega_dropdown>li>.item_link {height:auto}
.logged-in .imagemapper-wrapper .my_product_price {
display: block !important;
}
.imagemapper-wrapper .my_product_price { display:none !important; }
.logged-in .imagemapper-wrapper .my_add_item { display:block !important; }
.imagemapper-wrapper .my_add_item { display:none !important; }
.logged-in .my_product_footer .my_view_item {width: 50%}
.my_product_footer .my_view_item {width: 100%}
Adding to CSS did nothing, adding snippets from php below also.
CSS:
.woocommerce-result-count {
display: none;
}```
Snippets:
```removeaction ('woocommercebeforeshoploop', 'woocommerceresultcount', 20);```
Override woocommerce default styling like so:
.archive .woocommerce-result-count {
display: none !important;
}
I cant seem to find how to change the background of the woocommerce /product-category page. I've changed the archive and single product pages using this css:
.woocommerce.post-type-archive-product {
background-image:none !important;
}
.woocommerce.single-product {
background-image:none !important;
}
Which worked fine, but yeah I cant get it to work with the category page.
Thank you for any help.
please try this code in your functions.php
if(is_product_category()){
add_action('wp_head',function(){
?>
<style>
.woocommerce.post-type-archive-product {
background-image:none !important;
}
.woocommerce.single-product {
background-image:none !important;
}
</style>
<?php
});
}
in the above code, I used woocommece's condition tag to determine product category page and then added your CSS to its head section.
I want to hide the side bar and stretch the content box to full width to all posts from my WP blog. To individual posts that's what I'm doing, and it's working fine:
.postid-72 #main-sidebar {
display: none;
}
.postid-72 #main-content {
width: 100%;
}
But I'm looking for some way to apply this changes to all my blog posts, something hypothetical like this:
.postid-**every id posts** #main-sidebar {
display: none;
}
.postid-**every id posts** #main-content {
width: 100%;
}
I know that is possible to do something like this, which isn't usefull for me:
.postid-72, .postid-53, .postid-115 #main-sidebar {
display: none;
}
Every "single post" has a body class of single-post. So you could just do:
.single-post #main-sidebar {
display:none;
}
.single-post #main-content {
width:100%;
}
add a common class to all post like stretch-contentand use css like
.stretch-content #main-sidebar {
display: none;
}
.stretch-content #main-content {
width: 100%;
}
If you want to just set this two css by using post id then you can set only this two css in your header.php file inside head section with passing dynamic ID something like this:
First of all get current post id with : $id = get_the_ID() then pass it in your css using,
.postid-<?php echo $id; ?> #main-sidebar {
display: none;
}
.postid-<?php echo $id; ?> #main-content {
width: 100%;
}
Hope this will helpful for you.
Thanks.
Sounds like you are looking for the CSS Attribute Selector. Specifically:
The [attribute^="value"] selector is used to select elements whose attribute value begins with a specified value.
So to select any element with a class that starts with "postid-" you could use the following:
[class^="postid-"] #main-sidebar {
display: none;
}
[class^="postid-"] #main-content {
width: 100%;
}
Note the ^=
This will select all elements that have a class beginning with the string inside the quotes. Leaving out the ^ would yield the same results as using .postid- as the selector.
Also note, while these selectors can be a very powerful addition to your CSS toolkit they can have their pitfalls. It becomes much easier to unintentionally select other elements; especially in the large ecosystem of WP plugins.