Okay
  Public Ticket #1306135
Diable CSS & JS loading if checkbox is diabled
Closed

Comments

  •  3
    Guido started the conversation

    Hello,

    first of all thank for your geat work. But i have a question regarding the loading of additional js and css files. I have deactivated via the customizer the Lightbox. But the frontpage will still load the unneeded files.

    Is there a possibility to deactive the loading the fancybox via the customizer or can you update the contingency via a theme update?

    Thanks, Guido

  •  295
    Paul replied

    Hello Guido,

    In this case, please create a new child theme and add the following code to the "functions.php" of the child theme:

    <?php
    function child_theme_dequeue() {
        wp_dequeue_style( 'jquery-fancybox' );
        wp_dequeue_style( 'jquery-fancybox-helpers-thumbs' );
        wp_dequeue_style( 'jquery-fancybox-helpers-buttons' );
        wp_dequeue_script( 'jquery-fancybox' );
        wp_dequeue_script( 'jquery-fancybox-helpers-thumbs' );
        wp_dequeue_script( 'jquery-fancybox-helpers-buttons' );
    }
    add_action( 'wp_enqueue_scripts', 'child_theme_dequeue', 99 );
    

    Make sure to paste the code at the top of the file. The code will remove all the Fancybox's assets out of the file list.

    For more information about the child theme, please check out this article: https://uxbarn.ticksy.com/article/8649/

    Regards,
    Paul

  •  3
    Guido replied

    Hey Paul,

    thanks for you quick response. I solved it by creating a extra plugin which remove the unnecessary fancy box files. One Question: Do you plan to integrate the loading issue in a next theme update?

    Thanks Guido 

  •  295
    Paul replied

    Added to the list. Thanks for the suggestion!