1) 前端enque thickbox
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\');
}
}
2)将thickbox添加到所有由\\u content()显示的图像中;
function fb_add_thickbox($content){
$content = preg_replace(\'/<a(.*?)href="(.*?).(jpg|jpeg|png|gif|bmp|ico)"(.*?)><img/U\', \'<a$1href="$2.$3" $4 class="thickbox"><img\', $content);
return $content;
}
add_filter(\'the_content\', \'fb_add_thickbox\', 2);
资料来源:
http://wordpress.org/support/topic/how-to-implement-thickbox-to-all-images-which-contain-a-refered-linkhttp://www.ultimatewebtips.com/how-to-use-wordpress-native-thickbox-support-in-front-end/