Okay
  Public Ticket #3362614
External Leaflet files
Closed

Comments

  •  3
    Karina started the conversation

    Hi there, 

    is there an option to turn of loading external files, like the leaflet.js & leaflet.ccs

    We have very strict data protection policies in germany, and i need to host those files locally. I already tried adding them to my child theme, but if I try blocking the external files, the event single page won't load. 

    Thanks!

  •  877
    Zhivko replied

    Add this hook in your child-theme functions.php file:

    // Remove leaflet assets
    add_action('wp_enqueue_scripts', function(){
        wp_deregister_script('stec-leaflet-js');
        wp_deregister_style('stec-leaflet');
    }, 9999);



    Stachethemes Developer

  •  3
    Karina replied

    Yes, thank you, that works for removing the files. But then the event page won't work, even though I have included the files locally. 

    The Preview Works, but the .stec-single-sections is empty. 

    I included the files locally with this code: 

    function skor_enqueue_styles() {
    wp_enqueue_style('leafletcss', get_stylesheet_directory_uri() . '/leaflet.css', $child_style);
    wp_enqueue_script( 'leafletjs', get_stylesheet_directory_uri() . '/leaflet.js', array() );
    }

    add_action('wp_enqueue_scripts', 'skor_enqueue_styles', 200);

    Can you give me a hint what's wrong?



    Attached files:  Bildschirmfoto 2023-05-09 um 09.56.09.png

  •  3
    Karina replied

    I am sorry, that was my mistake, it was another error on my site. Thanks for the solution!