Home Forums Add-ons Gallery Field loading scripts conditionally


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.

    • Elliot

    • November 14, 2013 at 4:14 pm

    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.


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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.