Okay
  Public Ticket #3635720
Set Child Theme Stylesheet Version
Closed

Comments

  •  4
    fourtencreative started the conversation

    I am attempting to modify the child theme stylesheet version with this code:

    wp_enqueue_style( 'salient-child-style', get_stylesheet_directory_uri() . '/style.css', '', filemtime(get_stylesheet_directory() . '/style.css') );

    The parent theme seems to be overwriting the child theme enqueue script and keeps putting the parent theme version at the end of the url instead of my specified filetime or any other values I place in the version argument. If I change the handle argument, I can get around this but it double loads the stylesheet. Is this a bug? Or is there a workaround to prevent the parent theme version from being appended and instead maybe the cild theme version or other value to help with caching issues?

    Thanks!

  •  1,659
    Judith replied

    Hi there,

    Thanks for writing to us.

    Please allow me to pass this to the developer to be able to assist even better.

    I request your patience and understanding while we look into the issue.

    Best Regards.

  •  988
    ThemeNectar replied

    Hey fourtencreative!

    You can override the default enqueue and include a cache busting version by using the following method:

    function salient_child_theme_enqueue_stylesheet() {
      wp_enqueue_style( 'salient-child-style', get_stylesheet_directory_uri() . '/style.css', [], rand() );
    }
    add_action( 'wp_enqueue_scripts', 'salient_child_theme_enqueue_stylesheet', 999 );
    

    As long as you keep the function named "salient_child_theme_enqueue_stylesheet", it will override the parent enqueue functionality.

    Cheers

  •  4
    fourtencreative replied

    Awesome, thank you for this!

  •  988
    ThemeNectar replied

    You're welcome, fourtencreativesmile.png