在开发wordpress主题时,wordpress会自动添加我的style.css
,但它会分配版本号,我现在不知道它在哪里取版本值下面的链接是wordpress系统在css版本为4.3.1时添加到我每页的头部分的一个链接。
<link rel='stylesheet' id='twentytwelve-style-css' href='http://localhost/xyzwebsite/wp-content/themes/twentytwelve-child/style.css?ver=4.3.1' type='text/css' media='all' />
我想成为这样的
<link rel='stylesheet' id='twentytwelve-style-css' href='http://localhost/xyzwebsite/wp-content/themes/twentytwelve-child/style.css?ver=3.8.11' type='text/css' media='all' />
如果我没有弄错,您需要在style.css
中
/*
Theme Name: ThemeName
Version: 1.0.0
Author: yourname
Author URI: http://yourwebsite.com
Description: your description
Theme URI: your theme URL
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: random tags go here
*/
就在上面。此外,在您的functions.php
文件中,您需要
<?php
define('THEME_NAME', 'ThemeName');
define('THEME_VERSION', '1.0.0');
然后用将其放入functions.php
wp_enqueue_style('main_css', get_stylesheet_uri(), array(), THEME_VERSION);
如果你想在数组中使用,你可以让它依赖于其他样式表,主题版本紧随其后