Lightbox in WordPress


Description: 

Add the function shown under PHP to your functions.php in your child-theme. Then wrap your Thumbnail image in an a-tag like it is shown in HTML and give it the class ‘thickbox’.

Voor in de ‘Content template’








Kind:

CSS, HTML, PHP, Toolset


CSS:

.oplijn {
float: left;
margin: 10px;
}


HTML:

<a class="thickbox responsive_lightbox" href="..path to image..">
<br>
<img width="150" height="150" src="..path to image.." class="attachment-thumbnail" alt style title>
<br>
</a>


PHP:

// ADD LIGHTBOX functionality

add_action('wp_enqueue_scripts', 'add_thickbox');