Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1109619

    Hi,

    I’m trying to load a different, minified stylesheet with a timestamp for my Enfold child theme. I keep loading both style.css (ID = avia-style-css) and style.min.css. Am I dequeuing the wrong handle?

    
    function my_child_styles() {
        wp_dequeue_style( 'avia-style-css' );
        wp_deregister_style( 'avia-style-css' );
        wp_enqueue_style( 'my-child-style', get_stylesheet_directory_uri() . '/style.min.css', '', filemtime( get_stylesheet_directory() )  );
    }
    add_action( 'wp_enqueue_scripts', 'my_child_styles', 100 );
    

    I don’t have a production site for this. All local.

    Thanks
    johncory

    #1109950

    Hey johncory,

    It could be good if we can see it somehow, but how is this possible?

    Best regards,
    Basilis

    #1110106

    Sorry, I don’t have this on a production site.

    Here’s the source from my local site:

    
    <link rel='stylesheet' id='avia-custom-css'  href='http://test.loc/test/wp-content/themes/enfold/css/custom.css?ver=4.5.7' type='text/css' media='all' />
    <link rel='stylesheet' id='avia-style-css'  href='http://test.loc/test/wp-content/themes/enfold-child-test/style.css?ver=4.5.7' type='text/css' media='all' />
    <link rel='stylesheet' id='my-child-style'  href='http://test.loc/test/wp-content/themes/enfold-child-test/style.min.css?ver=1559080088' type='text/css' media='all' />
    
    #1110401

    Hi johncory,

    We need to see the actual css and html to be able to propose a solution for you. Please get back to us when you get the website to some testing server.

    Best regards,
    Victoria

    #1121788

    Nevermind.

    • This reply was modified 1 month, 3 weeks ago by  johncory. Reason: Removing private info
    #1121965

    Aha.

    Even though the style.css displays the ID ‘avia-style-css’ it is originally enqueued by enfold as ‘avia-style’ with no ‘css.’

    So, if someone else wants to do this and can’t figure it out, try this:

    add_action( 'wp_enqueue_scripts', 'enfold_remove_scripts', 9999 );
    function enfold_remove_scripts() {
        wp_dequeue_style( 'avia-style' );
        wp_deregister_style( 'avia-style' );
    }

    And look to Enfold functions.php section “Register frontend javascripts” when you’re trying to find the style enqueues.

    #1122589

    Hi,
    Thanks for sharing your solution, I assume we can close this now?

    Best regards,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.