订购Wordpress样式表? [英] Ordering Wordpress Stylesheets?

查看:144
本文介绍了订购Wordpress样式表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要最后加载的样式表的WordPress主题,因为插件CSS干扰了我的主题。我想知道是否有某种类型的函数可以用来将主样式表加载到我的主题中。

解决方案

当您排入样式表时,请使用更高的优先级,例如:

  add_action('wp_enqueue_scripts',array(& $ this,'theme_styles'),99); 

如果某些插件在'wp_print_styles'上有挂钩,那么您必须使用它,如'wp_print_styles ''将会在'wp_enqueue_scripts',iirc之后被写入。

由于您可以完全掌控自己的主题,所以您可以将自己的样式直接包含到header.php中,麻烦与行动是不值得的时间...

I have a wordpress theme with a stylesheet that needs to be loaded last, since plugin css are interfering with my theme. I was wondering if there was some type of function I could use to make the main stylesheet load last in my theme.

解决方案

when you enqueue your stylesheets, use a higher priority, e.g.:

add_action( 'wp_enqueue_scripts', array(&$this, 'theme_styles'), 99 );

If some plugins have hooks on 'wp_print_styles', then you have to use it instead, as 'wp_print_styles' will be written after 'wp_enqueue_scripts', iirc.

And as you have complete control over your theme, you also could include your styles directly into header.php, if the hassle with the actions isn't worth time...

这篇关于订购Wordpress样式表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆