Assuming your code really works - (is your markup actually filtered?) - this will not work, as the thick box is not activated. You must manually enter it:
As @Alexcp noted - you must register and queue javascript and css manually (outside the admin section). In addition to your preg_replace function, add the following to the Functions.php template.
// register scripts if (! function_exists(thickbox_register){ function thickbox_register() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery','http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js'); wp_register_script( 'thickbox', 'path to thickbox'.thickbox.js, 'jquery'); } } add_action('init', 'thickbox_register'); //print the now registered scripts if (! function_exists(thickbox_enqueue){ function thickbox_enqueue() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'thickbox' ); } } add_action('wp_print_scripts', 'thickbox_enqueue'); // do the same for css if (! function_exists(thickbox_style_enqueue){ function thickbox_style_enqueue() { wp_register_style( 'thickbox', 'path to css'.thickbox.css ); wp_enqueue_style( 'thickbox' ); } } add_action('wp_print_styles', 'thickbox_style_enqueue');
Note that there are several ways to get there - but you need to start with something like bloginfo('url'); .
If you still have problems, use FireBug or something like that to make sure thickbox is correctly registered in the jQuery DOM object.
Hope that helps
source share