Lightbox2 doesn’t work in a WP theme

I am converting one of my static templates to WP. The static template made use of Lightbox2 by Lokesh (http://lokeshdhakar.com/projects/lightbox2/), so I wanted to keep it in a new version too.

I’ve imported the styles and scripts as following:

wp_enqueue_style( 'lightbox', get_template_directory_uri() . '/assets/plugins/lightbox/css/lightbox.css' );
wp_enqueue_script( 'lightbox', get_template_directory_uri() . '/assets/plugins/lightbox/js/lightbox.min.js' );

and it is loaded in the page header alright.Lightbox is initiated the following way:

<a href="http://test3.ru/wp-content/uploads/2017/05/11.jpg" data-lightbox="gallery">
    <img src="http://test3.ru/wp-content/uploads/2017/05/11.jpg" class="img-responsive" alt="Onion">
</a>

However it does’t work for some reason, opening an image in a new tab. There are also no JS erros in console. Anybody happened to run into the same issue?

Read more here: Lightbox2 doesn’t work in a WP theme

Leave a Reply

Your email address will not be published. Required fields are marked *