I need to be able to update the child theme style.css and change the version number when I do so that I don’t have to clear the cache on cloudflare every time. I notice though that updating the version number doesn’t do anything, it always has the version number of the x-theme. Is there a way to make the style.css use a custom version number?
Hey @rsmith4321,
Thanks for writing in. Are you referring to the version number attached at the end of the child theme’s style.css?

You want it changed to the version of the child theme like this?

If so, this would need custom development. I will give you some guidance but please note that any issue arising from the use of this and any enhancement would be outside the scope of our support.
Now to achieve that, you first need to stop x_enqueue_site_styles function from loading then override it and then load it again. The code will look like this:
add_filter( 'after_setup_theme', 'my_style' );
function my_style() {
remove_action( 'wp_enqueue_scripts', 'x_enqueue_site_styles' );
add_action( 'wp_enqueue_scripts', 'x_enqueue_site_styles' );
}
function x_enqueue_site_styles() {
/* copy the function contents in themes\x\framework\functions\global\enqueue\styles.php
* change $rev = ( defined( 'X_CHILD_ASSET_REV' ) ) ? X_CHILD_ASSET_REV : X_ASSET_REV;
* to $rev = wp_get_theme()->get('Version');
*/
}
Any questions regarding the use of this should be directed to a developer.
If this does not work for you, we do have an in-house custom development team that offer paid services, who may be able to assist. They can be contacted at [email protected] if this is of interest to you.
Thanks.
Yes that is correct, thanks. Except I using pro, I’ll see if I can get it working from what you provided. I don’t understand why it doesn’t work this way in the first place, otherwise the version number in the child theme is pointless.
Hi there,
Yes, child theme version has no use at all. It doesn’t have any connection to the code. But it should work, just make sure the child theme is active.
Let us know how it goes.
Thanks!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.