• Resolved marleneayers

    (@marleneayers)


    I understand that the storefront theme automatically enqueues the style.css for its child themes. I want to set up style.css versioning to eliminate cache issues. The instructions are:
    function wpshout_force_css_refresh() {
    wp_dequeue_style( ‘[STYLESHEET_SLUG]’ );
    $rand = rand( 0, 999999999999 );
    wp_enqueue_style( ‘[STYLESHEET_SLUG]’, [PERMALINK_TO_STYLESHEET], [STYLESHEET_DEPENDENCIES], $rand );}
    add_action( ‘wp_enqueue_scripts’, ‘wpshout_force_css_refresh’ );`

    I am using “storefront-child-style” as the stylesheet slug. This works correctly but now the parent(storefront) theme is loading last forcing me to use !important on all my style rules. Anybody familiar with this issue? Here is the code that I am using.

    function wpshout_force_css_refresh() {
        wp_dequeue_style( 'storefront-child-style' );
        $rand = rand( 0, 999999999999 );
        wp_enqueue_style( 'storefront-child-style', get_stylesheet_directory_uri()."/style.css", '', $rand );
    }
    add_action( 'wp_enqueue_scripts', 'wpshout_force_css_refresh' );

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Storefront child theme and css cache’ is closed to new replies.