Editing style.css

Posted in: Newsmag
Post count: 110

I’m trying to edit my theme’s /style.css through WordPress editor (https://roadtovr.com/wp-content/themes/Newsmag/style.css). I’m doing this by going to WordPress -> Appearance -> Editor -> Theme Newsmag -> Style.css.

I can edit style.css just fine, and when I visit the URL above I can see the change is live.

However, when I load the front page of my site, I can see that the file that’s really being served is /style.css?ver=3.2, and this version does not include the changes I made in the editor.

How do I edit /style.css?ver=3.2 specifically?

Post count: 9544

Best way is to download via FTP to PC, edit in text editor, resave, then reupload, keeping backup copy for changes so you can roll back if you mess something up.
(I don’t work here.)

Post count: 110

I’d love to be able to edit it directly through the editor, but even if I have to do it via FTP… I still need to know which file to edit exactly. Because https://roadtovr.com/wp-content/themes/Newsmag/style.css doesn’t seem to be the correct file.

Post count: 9544

if you edit it and not being served latest version, will be caching issue… you can try hard cache clear in chrome.

ftp still best way as you know for sure latest version on server. ver=3.2 is not part of filename but caching control.

Post count: 110

ver=3.2 seems to be related to the version number of the style.css sheet rather than a cache: https://i.imgur.com/FzlXHGw.png

I’ve tried clearing every cache I have access too and can’t get any changes to stick.

Post count: 20688

Hi,

That is the theme version. Newsmag 3.2 was released about 8 years ago. Maybe it would be worth considering to update the theme if possible.

I would not advise making modifications directly in the theme stylesheet. These will be lost when updating the theme or reinstalling it. Instead it would be better to load the CSS you want in other ways. You can override CSS from the theme or add new code by using other methods.

I’m not sure, but I believe that the theme used to have a custom CSS section back then as well https://prnt.sc/8o8D1tSccpH1 Could you please check? Or you could add CSS in the wordpress customizer panel https://prnt.sc/8E0yUhbSt5Tm -> https://prnt.sc/JBxjRTC_OlMe or with a plugin. Or through a child theme.

But if you want to modify the stylesheet directly, that should be possible.

Let us know if we can help or if you have questions. Assuming the code is valid, maybe all it needs to see the changes is to clear the cache, and purge the CDN files if you use one. But I would still suggest not doing it that way, and instead add the code you want in a different way. Could you please mention what modifications you want to make, or what code you want to add?

Thank you!

Post count: 110

Thanks for the insights Simion. Yes we’re on a very old version but can’t update for fear of breaking other things on the site (running an old version of WP and PHP).

My goal with editing style.css is to minify the style.css. It’s excessively large and causing speed issues with the site.

If directly editing style.css isn’t possible, can you recommend any other ways to minify it?

We use W3 Total Cache, which is supposed to support CSS minification, but it doesn’t appear to be doing this for style.css Maybe this is an incompatibility issue between the theme structure and W3 Total Cache, or maybe it is minifying style.css but not style.css?ver=3.2, which is the actual file being served?

I’ve tried kicking all available caches on /style.css and /style.css?ver=3.2, and what happens is I can see the minfification when I load /style.css, but when I load /style.css?ver=3.2, I only see the old code. And as I mentioned, the file that’s actually being serve to visitors is /style.css?ver=3.2.

Post count: 9544

Kind of a hack, but have you tried changing the version noted in the style.css file to 3.3 and leave that line in after minification?

E.g., copy the top section into another text file; run style.css through minification service (e.g., https://www.toptal.com/developers/cssminifier ); then when it’s compressed, paste the original top section with theme version info back on top above the ‘single line’ minified code. Change version number to 3.3. Upload via FTP, over-writing the original file.

Anyway— that’s what I would do.

Also, the move from 3.2 to 5x was not so bad. I tried this recently. Site running latest WordPress and PHP 7.4x. Main issue was redoing home page, but making note of blocks before switch; moving any custom CSS to the WordPress customizer outside theme; noting settings for any widgets and footers (copy paste any custom code into text file before upgrade); note the modules used for sidebar. Actually was not too bad. Of course, I’ve only done one of the 8 sites so far, but actually not too bad. If running PHP 5x kinda screwed on multiple levels, though. 🙂

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