admin管理员组文章数量:1295296
I'm working on Wordpress + Bootstrap 4 by customising according to the design. The default style.css loads as:
<link rel='stylesheet' id='wp-bootstrap-starter-style-css' href='http://localhost/hrone/wp-content/themes/theme_name/style.css?ver=5.2.3' type='text/css' media='all' />
I would like to change the version from 5.2.3 to 5.2.4 or auto change it time base. How do I go about doing this? I have just 1 css file since this is a custom theme.
I'm working on Wordpress + Bootstrap 4 by customising according to the design. The default style.css loads as:
<link rel='stylesheet' id='wp-bootstrap-starter-style-css' href='http://localhost/hrone/wp-content/themes/theme_name/style.css?ver=5.2.3' type='text/css' media='all' />
I would like to change the version from 5.2.3 to 5.2.4 or auto change it time base. How do I go about doing this? I have just 1 css file since this is a custom theme.
Share Improve this question asked Sep 30, 2019 at 14:48 Elaine ByeneElaine Byene 1177 bronze badges3 Answers
Reset to default 1It's using 5.2.3
because no version was specified when style.css
was enqueued/registered. So it fell back to the version of WordPress.
If you pass in a version when calling wp_enqueue_style
, it will use that value instead
In your functions.php file (you're using a custom child theme, right?) change/add the version parameter to wp_get_theme()->get( 'Version' )
this will pull the version number from your theme's style.css file.
https://developer.wordpress/reference/functions/wp_enqueue_style/
Setting this parameter to false will use the WordPress version.
wp_get_theme() returns the theme object for the current theme which contains the version. wp_get_theme()->parent()->get( 'Version' ) will return the parent themes version.
$parent_style = 'wp-bootstrap-starter';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css', false, wp_get_theme()->parent()->get( 'Version' ) );
wp_enqueue_style(
'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get( 'Version' )
);
Change the version number in your style.css file.
Edit: I misunderstood. I think that's the WordPress version.
本文标签: jqueryChange the version of default stylecss in wordpress
版权声明:本文标题:jquery - Change the version of default style.css in wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741609169a2388156.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论