Pit Digger
Pit Digger

Reputation: 9790

Adding Lightbox to wordpress

I need to add lightbox to a theme instead of using the plugin. I added it and everything works fine but for some reason close.png and loading.gif images keeps referring to site.com/images/close.png . My lightbox.js is in themes/mytheme/libs and images are in themes/mytheme/images . I have changed lightbox.js as following .

 this.fileLoadingImage = '../images/loading.gif';
  this.fileCloseImage = '../images/close.png';

Upvotes: 2

Views: 331

Answers (1)

McNab
McNab

Reputation: 6777

If you are needing to include the full path in your lightbox.js file one way to do it is to follow this example -> Path to WordPress Template Directory inside jQuery?

You would set the value of a variable to the Wordpress template directory in your header.php prior to the inclusion of lightbox.js and then use that variable to produce an absolute path;

 <script type="text/javascript">
     var templateDir = "<?php bloginfo('template_directory') ?>";
 </script>

Upvotes: 1

Related Questions