Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
I have added the following code to my child theme functions.php file to append version number to child theme style.css. But the version number is not getting appended to the child theme style.css
$child_theme_url = get_stylesheet_directory_uri();
$theme_num = wp_get_theme()->get('Version');
wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), $theme_num, 'all' );
The output for the above should be
<link rel='stylesheet' id='avia-style-css' href='/wp-content/themes/mychildtheme/style.css?v=1.0.1' type='text/css' media='all' />
but it only show as
<link rel='stylesheet' id='avia-style-css' href='/wp-content/themes/mychildtheme/style.css' type='text/css' media='all' />
What am I doing wrong?
Thanks
Hey pepin,
Can you try to replace $theme_num with a string of number? for example ‘1.0.1’
If that still doesn’t append 1.0.1 to it then maybe you have some custom code that removes query strings from static sources or maybe this is removed by a plugin.
Here’s an example of the custom code that might have been added: https://www.hostinger.com/tutorials/remove-query-strings-static-resources/
Best regards,
Nikko