Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active May 14, 2021 12:57
Show Gist options
  • Select an option

  • Save mapsam/b3afa4ada1e34bd2ccbb to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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