Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active May 14, 2021 12:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapsam/b3afa4ada1e34bd2ccbb to your computer and use it in GitHub Desktop.
Save mapsam/b3afa4ada1e34bd2ccbb to your computer and use it in GitHub Desktop.
Wordpress ACF Lightbox
<?php
// include the lightbox JavaScript and CSS files in your header file.
// You can wrap them around a conditional if you want them to load
// only when you need them (i.e. only if the 'gallery' field has content)
// The lightbox.js file does all of the heavy lifting for you, no
// custom JS needed!
if(get_field('gallery')) {
echo '<link rel="stylesheet" type="text/css" media="all" href="'.get_stylesheet_directory_uri().'/PATH/TO/YOUR/SCRIPTS/lightbox.css">';
echo '<script type="text/javascript" src="'.get_stylesheet_directory_uri().'/PATH/TO/YOUR/SCRIPTS/lightbox.js"></script>';
}
@Nayal841
Copy link

thank you very much is easy and super

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment