我是Wordpress的新手,我需要将一个PSD转换为Wordpress主题。 为此我开始下载一个裸体wordpress主题,我尝试在function.php中添加我自己的css样式,如下所示:
function naked_scripts() {
// get the theme directory style.css and link to it in the header
wp_enqueue_style( 'main-style', get_template_directory_uri() . '/style/main.css' );
wp_enqueue_style( 'responsive-style', get_template_directory_uri() . '/style/responsive.css' );
wp_enqueue_style( 'bootstrap-style', get_template_directory_uri() . '/style/bootstrap.min.css' );
// add fitvid
wp_enqueue_script( 'jquery-js', get_template_directory_uri() . '/js/jquery.js', array( 'jquery' ), '1.10.2', true );
// add theme scripts
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '3.0.3', true );
}
add_action( 'wp_enqueue_scripts', 'naked_scripts' ); // Register this fxn and allow Wordpress to call it automatcally in the header
但是在浏览器中我没有得到我的风格,我有他的错误:
GET http://rota.alwaysdata.net/wp-content/themes/theme1/style/main.css?ver=4.1
什么是ver = 4.1 ??
答案 0 :(得分:1)
它是由WordPress添加的缓存破坏程序。您可以使用$ver
wp_enqueue_style
参数将其设置为您想要的任何数字
http://codex.wordpress.org/Function_Reference/wp_enqueue_style
?ver = X.XX对样式表的内容有 NO 影响。
CSS Cache-busting references:
http://css-tricks.com/snippets/wordpress/prevent-css-caching/ https://www.mojowill.com/developer/get-your-wordpress-css-changes-noticed-immediately/
答案 1 :(得分:0)
我建议您是否第一次使用这些资源创建wordpress模板:
突显空白的wordpress主题: http://underscores.me/
Lynda.com强调教程:
http://www.lynda.com/underscores-tutorials/WordPress-Building-Themes-from-Scratch-Using-Underscores/163092-2.html
这就是我以前制作我的第一个wordpress项目并且它解决了,这是结果:ibreatheart.com
希望它有所帮助。