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/