fyyr start

Posted on: October 28th, 2014 by admin No Comments


Thickbox gallery in WordPress

Posted on: October 12th, 2012 by admin No Comments

How to Enable the native thickbox gallery in WordPress.

1. These lines go into the functions.php file in your theme.
wpcontent->themes->’your theme’->function.php

wp_enqueue_script('thickbox', true);

2. These lines go into the footer.php file in your theme to add class ‘thickbox’ to the <a> tag surrounding your images.

<script type=”text/javascript”>// <![CDATA[
/* <![CDATA[ */ jQuery(‘a img.attachment-thumbnail’).parent().addClass(‘thickbox’).attr(‘rel’, ‘page’); /* ]]> */
// ]]></script>

for the gallery to work you need to point the gallery to the image file.
like so

in posts or pages and like so
<?php echo do_shortcode('[gallery link="file"]'); ?>
in theme templates.

3. Your image tags should look like this now:
<a class="thickbox" title="IMAGE TITLE" href="ATTACHMENT URL" rel="page">
<img class="attachment-thumbnail" title="IMAGE TITLE" alt="IMAGE ALT" src="IMAGE URL">