最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

css - Plugin and themes are adding the same stylesheets

programmeradmin3浏览0评论

/vendors/font-awesome/font-awesome.min.css? ver=2.9.10

/yith-woocommerce-wishlist/assets/css/font-awesome.min.css? ver=4.7.0

/theme/css/font-awesome.min.css

**this csss are from different plugins and main theme.

and error is :

The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 2 request(s) and 60.5KiB.**

how can i combine them as one?

autoptimize wp plugin is not compatible with my website.

/

/vendors/font-awesome/font-awesome.min.css? ver=2.9.10

/yith-woocommerce-wishlist/assets/css/font-awesome.min.css? ver=4.7.0

/theme/css/font-awesome.min.css

**this csss are from different plugins and main theme.

and error is :

The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 2 request(s) and 60.5KiB.**

how can i combine them as one?

autoptimize wp plugin is not compatible with my website.

https://www.tarhdokan/

Share Improve this question edited Dec 19, 2019 at 22:17 RiddleMeThis 3,8078 gold badges22 silver badges30 bronze badges asked Dec 19, 2019 at 21:54 adam skadam sk 93 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

You can use wp_dequeue_style() to remove CSS a plugin is adding.

You can use it to dequeue the 2 stylesheets coming from your plugin and just keep the one in your theme.

However, they appear to be different versions of Font Awesome so you may run into some issues there, I'm not sure I don't use Font Awesome.

Here is an example of wp_dequeue_style() which you can edit and add to your theme's functions.php.

function wpse_remove_styles() {
   wp_dequeue_style('dokan-fontawesome');
}
add_action( 'wp_print_styles', 'wpse_remove_styles', 100 );

Note: You will need the handle for the stylesheet, which you can usually get by viewing the source, finding the stylesheet ID and removing -css. For example, in your case...

<link rel='stylesheet' id='dokan-fontawesome-css' href='.../vendors/font-awesome/font-awesome.min.css?ver=2.9.10' type='text/css' media='all' />

The handle should be dokan-fontawesome.

发布评论

评论列表(0)

  1. 暂无评论