Support

Account

Home Forums Add-ons Gallery Field loading scripts conditionally

Solved

loading scripts conditionally

  • Hi,
    Great work with ACF, I just purchased all 4 add-ons 🙂

    I just watched the video for the gallery add-on and was wondering if there is a reason why the script and css isn’t wrapped like this…

    <?php $images = get_field('image_gallery'); if( $images ): ?>
    <!-- stylesheets and scripts -->
    <?php endif; ?>

    This way It would only be called on pages that have a gallery, rather than all pages regardless.

  • Hi @zhirkovski

    The code example is exactly that, an example. It is to demonstrate how to do a task, not to be used literally.

    Thanks for your concern.

    Cheers
    E

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

The topic ‘loading scripts conditionally’ is closed to new replies.