Viewing 3 replies - 1 through 3 (of 3 total)
  • Thickbox doesn’t run on the public facing side of the site, Thickbox is native to the administration side of the site only, if you want to use thickbox on your blog pages (ie. archives, posts, etc), you’ll need to load the thickbox JS and stylesheet.

    This blog covers the necessary details on how to load thickbox on blog/public side of your site.

    myhtmlworld.com/wordpress/create-thickbox-wordpress.html

    Hope that helps.. ??

    Thread Starter deezlee

    (@deezlee)

    hey, thanks for the answer! I guess that I should have been more clear. I am using the “auto-thickbox” plugin on my site. Images in posts pop up in the Thickbox fine on the main content area of the page.

    here is the site (very much under construction!)
    https://deezlee.com/lodge/property/sage-hill-cabin

    the test image at the bottom of the post auto-thickbox’s fine. In the sidebar, the images don’t auto-thickbox… i just tested and they work if you add the thickbox class manually to the image tag like i did on the bottom image in the sidebar.

    I now realize that it’s the auto-thickbox plugin that is not handling this application.

    any ideas?

    Thanks again in advance

    Apply the thickbox class to any links in the sidebar that have an image as a child?

    jQuery(document).ready(function($) {
    	// Iterate over each link in the sidebar without a thickbox class
    	$('div#sidebar a:not([class*="thickbox"])').each( function() {
    		// If the link has an image as a child
    		if( $(this).has('img') )
    			// Add the class
    			$(this).addClass('thickbox');
    	});
    });

    Easiest way to add the code would be to take the above, plonk it in a file with a .js extension, put it in your theme’s folder, then add an enqueue for the script like so in your theme’s header (before the call to wp_head)..

    wp_enqueue_script( 'thickbox_adder', get_bloginfo( 'stylesheet_directory') . '/name-your-gave-the-file.js', array('jquery') );

    The reference to jquery simply tells WordPress that jQuery is a dependancy, so it ensures the script is correctly included after jQuery.

    Untested, but it should do the job.. ??

    References to functions used above:
    https://codex.www.ads-software.com/Function_Reference/wp_enqueue_script
    https://codex.www.ads-software.com/Function_Reference/get_bloginfo
    https://api.jquery.com/jQuery.each/
    https://api.jquery.com/has/
    https://api.jquery.com/addClass/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘thickbox doesn't work in sidebar loop?’ is closed to new replies.