Support

Account

Home Forums Add-ons Flexible Content Field Flexible Content Layout Conditional Reply To: Flexible Content Layout Conditional

  • When you use wp_register_script() set $in_footer to true.

    Or alternately, just call wp_enqueue_script() with all of the arguments including $in_footer in your loop.

    I’m using slick as well and in my template part for each layout I have something like this

    
    wp_enqueue_script('slick', get_template_directory_uri().'/assets/vendor/slick/slick.min.js', array('jquery'), '1.8.1', true);
    wp_enqueue_script('slick-init', get_template_directory_uri().'/js/slick-init.js', array('jquery', 'slick'), '1.0.0', true);
    

    My slick init script actually is pretty complicated and I give each type of slider a different class and then initialize each class. This way I have just a single initialization script to load and it remains the same on all pages so that it can be cached by the browser and does not cause other caching issues.