Add versioning of child theme css

Posted in: Newspaper
Post count: 9

Hi

After some larger design updates I would like to force visitors to get the new theme css file by adding the child theme version as a query string to the css.

Today the child theme css looks like this in the head section:
https://i.imgur.com/oq65B4z.png

I have the following script in my child theme functions.php:

add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, 11);
function theme_enqueue_styles() {
wp_enqueue_style(‘td-theme’, get_template_directory_uri() . ‘/style.css’, ”, TD_THEME_VERSION, ‘all’ );
wp_enqueue_style(‘td-theme-child’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘td-theme’), TD_THEME_VERSION . ‘c’, ‘all’ );
}

How would I modify the wp_enqueue_scripts above to achieve that?

Post count: 18283

Hello !

What exactly would you want to achieve with this. Please provide more details about what you want to achieve.

I’ve found something similar about what I think you want here: https://gist.github.com/vidluther/2941787

THank you !

Post count: 9

I want to add a query string to bust the browser cache for returning visitors so that they get the new css styles from my child theme when we are making design updates. Like this:

<link rel=’stylesheet’ id=’td-theme-child-css’ href=’https://lastat3.wpengine.com/wp-content/themes/lastat-nyheter/style.css?ver=3.0&#8242; type=’text/css’ media=’all’ />

I read a lot of articles about this and most referred to modifying the wp_enqueue_scripts. But I couldn’t get that to work when trying to modifying the code that is in the child theme by default.

I tried the code you linked to above by adding it in Code Snippets but it did not work. This is what it looks when running it on my website:

https://i.imgur.com/xPyJAJ4.png

I would prefer it it added the version that I specify in my child theme css stylesheet but filemtime or anything other will work just as well.

How could I do that?

Post count: 18283

Hello !

This requires custom work and we cannot offer that due to our support policy: https://forum.tagdiv.com/newspaper-theme-support/ So you will have to find a freelancer and hire to do the modifications you want.

You can look one on studio.envato.com.

We are sorry for the inconvenience !

Thank you !

Post count: 9

Haha. Awesome. First I ask you and you give me a solution that does not work with your theme.

And then when you ask me to clarify you respond like that.

This should be a minor modification of the wp_enqueue_scripts in the child theme functions.php. And as the developers of the theme I thought you would be able to answer this easily.

But instead you ask me to get a developer to dig into how the theme works. Great thanks…

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.