Thickbox support in front end

Thickbox is as jQuery plugin that WordPress use as it’s main popup window or modal view. It’s already built-in in WordPress so why not use that in front end. No need to download or import any extra files.


Hook that with a function


add_action('init', 'myplugin_thickbox');
function myplugin_thickbox() {
	if (! is_admin()) {
		wp_enqueue_script('thickbox', null,  array('jquery'));
		wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');

To add Thickbox, we only need to add class=”thickbox” and it will automatically add the onclick trigger.

<a title="Title" href="">Google search</a>