0

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.

0

It'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

  • `wp_enqueue_style' creates a new css file which isn't what I want. – Elaine Byene Sep 30 '19 at 15:48
  • You theme already calls wp_enqueue_style() somewhere. You need to specify the version wherever that is. It appears to be line 80 of functions.php in the latest version. – Jacob Peattie Sep 30 '19 at 16:21
  • I have this in line 80 function wp_boostrap_starter_add_editor_styles() { add_editor_style( 'custom-editor-style.css' ); } add_action( 'admin_init', 'wp_boostrap_starter_add_editor_styles' ); which isn't the style.css but the custom css file. I'm working on style.css. – Elaine Byene Sep 30 '19 at 19:10
  • 1
    @ElaineByene wp_enqueue_style does not create new files, and it is style.css because it says so in the HTML of your question, it'll be enqueued as bootstrap-starter-style judging from the id attribute – Tom J Nowell Sep 30 '19 at 22:48
0

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.org/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' )
);
-1

Change the version number in your style.css file.

Edit: I misunderstood. I think that's the WordPress version.

  • That’s not where this number comes from. – Jacob Peattie Sep 30 '19 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.