Why file plugins/woocommerce/assets/css/woocommerce.css
for my template can not be read?
Please look this image :
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityfunction woocommmerce_style() {
wp_enqueue_style('woocommerce_stylesheet', WP_PLUGIN_URL. '/woocommerce/assets/css/woocommerce.css',false,'1.0',"all");
}
add_action( 'wp_head', 'woocommmerce_style' );
paste the above code in your "functions.php". woocommerce stylesheet will be executed to your site
I had this problem, I added "woocommerce woocommerce-page" classes to body, or parents of woocommerce loop, so it solved the problem,
actually, woocommerce main classes are not add to page.
As @ali-h correctly points out, the missing body classes are the culprit here...
You can solve this by using the corresponding filter body_class
and add your own classes, in this case the WooCommerce-specific ones:
/**
* Add <body> classes
*/
add_filter('body_class', function (array $classes) {
/** Add WC classes if on a custom template or when viewing search results */
if (is_page_template('directory-name/page-something.php') || is_search()) {
$classes[] = 'woocommerce woocommerce-page';
}
return array_filter($classes);
});
woocommerce.css
Then try to manually call that file like<link href="<?php bloginfo('template_directory')?>/../../plugins/woocommerce/assets/css/woocommerce.css" rel="stylesheet">
. And if u r using child them then usebloginfo('stylesheet_directory')
instead ofbloginfo('template_directory')
to callwoocommerce.css
.