How to prevent from woocommerce css over rides template css file? - css

As you see in following pictureenter image description here.
woocomerce css styles has magically over ride my template css (after using yith tab manager permiume (disabling doesn't help).
You can see that disable those styles from woocomerce.css will prove that, y template style is still there.
How can I prevent from this issue ?
Here is the website link for that page
amatistrading.
I used this code in functions.php of template but it didn't work:
:// Disable WooCommerce's Default Stylesheets
function disable_woocommerce_default_css( $styles ) {
// Disable the stylesheets below via unset():
unset( $styles['woocommerce-general'] ); // Styling of buttons, dropdowns, etc.
// unset( $styles['woocommerce-layout'] ); // Layout for columns, positioning.
// unset( $styles['woocommerce-smallscreen'] ); // Responsive design for mobile devices.
return $styles;
}
add_action('woocommerce_enqueue_styles', 'disable_woocommerce_default_css');

i couldnt use that code(in main comment) but i found a way to solve problem. ( i will put the right code if i find any),first we can delete that stylesheet content, or act like me: disable all plugins(every single plugin) try to replace woocommerce files with orginal, then re active plugins, this method worked for me, it seems changing woocommerce files made this problem.

Related

Remove handheld footer menu links Woocommerce

I am trying to remove the search link from the Woocommerce handheld footer menu which appears when using a mobile device.
I have tried following the official Woocommerce guide here on Customizing links in the handheld footer menu, but the code doesn't change the behaviour. I have already tried clearing cache, cookies & inprivate browsing to test. Any suggestions why this isn't changing?
Code:
add_filter( 'storefront_handheld_footer_bar_links', 'jk_remove_handheld_footer_links' );
function jk_remove_handheld_footer_links( $links ) {
unset( $links['search'] );
return $links;
}
The above code will work. However, if you are modifying the HTML of storefront_handheld_footer_bar_links anywhere else in your Woocommerce site, this will override and take precedence of the PHP function.
Bear this in mind when trying to modify the above function.
Thanks #Orlando P. for help in debugging.

Apply CSS file from activated WordPress Plugin

I am new to wordpress and want to know best way to add css from installed and activated plugin.
I have one activated plugin called "social-media" and in that plugin i have created one css file called "social-login-style.css"
I want to include this css file and apply style to my content. How should I add css file in any page so that I can see the effects.
In Short, I want to add social-login-style.css on wp-login.php file.
Whether it is theme or plugin, css or js, any custom addition, wp_enqueue_scripts is the only acton you need for all.
https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts
function additional_custom_styles() {
/* Enqueue The Styles */
wp_enqueue_style( 'custom-login-style', plugins_url( 'social-login-style.css', __FILE__ ) );
}
add_action( 'wp_enqueue_scripts', 'additional_custom_styles' );
If you it to be added only on login screen then use the following condition,
if ( $GLOBALS['pagenow'] === 'wp-login.php' ) {
// We're on the login page!
}
Hope this one help :)
UPDATE
Please check login_enqueue_scripts. it is designed to add custom scripts into login page only. Works well without any login condition.
https://codex.wordpress.org/Plugin_API/Action_Reference/login_enqueue_scripts
Without saying what you want to achieve is impossible, it certainly is against how WordPress is designed to work. Plugins are supposed to be modules that add to or modify how WordPress works. The folder of a plugin should only hold files pertaining to what the plugin does and, if it's a public plugin, its contents are controlled by a versioning (SVN) system.
In short, adding a file to an existing plugin will not have any effect, regardless of whether the plugin is active or not. And you should not add files to plugins you haven't developed yourself.
To load a CSS file on the login page, one should add an action hook to login_enqueue_scripts, as instructed in Customizing Login Form page of the codex. The stylesheet itself should be placed in either a custom plugin (you could create for your use-case) or inside the current theme folder.

How to remove footer from some pages dynamicaly using function.php

I am new to wordpress and learning Plugin development, I m creating a custom plugin, which display a list of page-title with check-boxes in admin section and on checking the selected pages footer should be remove from that pages, now I m facing issue with how to remove footer section?
I dont want to remove footer on single page, so custom template can not be used
I dont want to remove footer using css(like display none)
Can anybody help?
You can use Wordpress's remove_action to help remove unwanted php calls. More on that found here
Something like this:
function your__conditional_footer() {
if( is_front_page() )
return;
remove_action( 'theme_before_footer', 'theme_footer_widget_areas' );
}
Mind you, the function arguments are theme dependent.
Hope this points close.

WooCommerce - find all classes and elements to customize via CSS

I'm trying to modify the WooCommerce Shop, Cart, and Checkout page using CSS, and was wondering if there's a way to find out all the classes used in these pages.
The concept that I am following is the one suggested here: http://docs.woothemes.com/document/css-structure/#section-2 where I can make changes on my theme's CSS. Like adding a.button, button.button, input.button, #review_form #submit { background:black; } to my theme's stylesheet, and so on.
Is there a way to know these classes, or do I have to manually inspect the elements in every page and modify them based on the classes visible in it? Any advices? Thank you.
I always find it helpful to look at the base CSS files.
https://github.com/woothemes/woocommerce/tree/master/assets/css this is the current active repository for all WooCommerce CSS files (broken out).
The SCSS definitely DOES have the style commented by page if you want to focus on shop/cart/checkout.
If you download the current base files, remove the WooCommerce ones through functions:
// Remove each style one by one
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
// Or just remove them all in one line
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
Then you can effectively override as needed directly from the "source" that won't conflict with future updates to Woo. If you ever wanted to update in the future, you could always do a DIFF using your overrides and Woo's CSS.
Or you could just grab the pieces you need :)

How to prevent bootstrap from interfering with theme

I am working on a WP plugin that uses bootstrap. However, it seems to be having a very strange affect on the page. You can see it here:
My Test Page
If you go to this page, then go to another, you will see that the page goes back to normal.
How can I prevent bootstrap from affecting the WP elements on the page?
add_action( 'wp_enqueue_scripts', 'bootstrap_css', 150 );
function bootstrap_css(){
// add pages for bootstrap leave out site address, just the path e.g.
$pages= array( '_3_8_0/rentals/','add_page_url' );
$path=$_SERVER['REQUEST_URI'];
if( !in_array($path, $pages) ):
wp_dequeue_style( 'bootstrap_handle' ); // look up handle for stylesheet
endif;
}
You can do something like the above to de_queue the bootstrap css on pages that you dont want it on. The problem is Bootstrap is not really designed for singular page use with a existing theme and will share a lot of common identifers with what your theme uses e.g. "content"
its either that or remove bootstrap altogether (just de-queue it) and style the page yourself. To be honest bootstrap is a heavy load for the use case here.

Resources