Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #672174

    Today I was editing my child theme, and wasted 2 hours trying to figure out why my css wasn’t having any effect, until I examined the HTML source for the page generated by WordPress.

    I noticed that the call to my child theme CSS had a ‘?ver=2’ appended to the end of the file name.

    Having done some digging in functions.php I found the following line:

    wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), '2', 'all' );

    I changed this to

    wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), '', 'all' );

    and now it is working, and when I modify my child theme, it is working with the latest version when the page is refreshed.

    My question is why is version ‘2’ hard coded into the functions.php?
    Also where do the version numbers come from? When I modify the code as described above, and check the HTML again, it is now using ver=4.5.3 ; I have never specified a version of my child theme when I created it, where does this number 4.5.3 come from?
    Why is a version hardcoded into functions.php?
    and do I cause any problems by deleting the version as I have done above, so it uses the current version?

    Looking forward to be enlightened, as I usually am when I post here.

    Regards

    Spleeky

    • This topic was modified 8 years, 3 months ago by spleeky.
    #672457

    This is still causing me trouble, I am changing my child style sheet, but it’s using a version that I can’t see anywhere that doesn’t have my changes. Can someone help, I want to simply ensure every time I change the css sheet, that the site uses the latest version. I’ve used a private browser, and it’s still using an old version.

    #673459

    Hi,

    Thank you for using Enfold.

    The parameter is specified to ensure that the correct version of the file is used regardless of caching. If not set, it will used the default WP version string thus the “4.5.3”. Please deactivate all cache plugin and hard refresh the page every time a change is committed to the file.

    Best regards,
    Ismael

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.