Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>add this to your functions.php file in your theme:</p> <pre><code>&lt;?php // Adds thickbox to all images with a link inside of $content. // Uses the title attribute in the Media Library. add_filter('the_content', 'brentini_addthickboxclass'); function brentini_addthickboxclass($content) { add_thickbox(); $pattern[0] = "/&lt;a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)&gt;/i"; $replacement[0] = '&lt;a$1href=$2$3.$4$5 class="thickbox"&gt;'; $pattern[1] = "/(&lt;a href=)('|\")([^\&gt;]*?)(\.bmp|\.gif|\.jpg|\.jpeg|\.png)('|\")([^\&gt;]*?)(&gt;)(.*?) title=('|\")(.*?)('|\")(.*?)(&lt;\/a&gt;)/i"; $replacement[1] = '$1$2$3$4$5$6 title=$9$10$11$7$8 title=$9$10$11$12$13'; $pattern[2] = "/(&lt;a href=)('|\")([^\&gt;]*?)(\.bmp|\.gif|\.jpg|\.jpeg|\.png)('|\")([^\&gt;]*?) title=([^\&gt;]*?) title=([^\&gt;]*?)(&gt;)(.*?)(&lt;\/a&gt;)/i"; $replacement[2] = '$1$2$3$4$5$6 title=$7$9$10$11'; $content = preg_replace($pattern, $replacement, $content); return $content; } </code></pre> <p>It will work flawlessly if you do it exactly like this. There is no need to add all of those calls that others have mentioned. It isn't at all necessary since WordPress natively includes jquery and thickbox for use on the backend. So add_thickbox() is all you need to call thickbox in your theme. The rest of the script simply adds class="thickbox" to any image inside $content and uses the title attribute from the WordPress Media Library.</p> <p>If you are interested in a script which includes this plus Thickbox support for galleries with navigation as well, check it out at <a href="http://pastebin.com/bijiUztb" rel="nofollow">pastebin</a>.</p> <p>For a more simplified version that does not include navigation, <a href="http://pastebin.com/aEEwtEmW" rel="nofollow">this one at pastebin</a> uses jquery to add the thickbox class to galleries.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload