Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need to create a link in admin that uses the WP thickbox WordPress


I'm simply trying to link to a simple HTML file from my theme options page that will open in the thickbox that WordPress uses for the media upload on the edit post page. I could create my own but I think it makes more sense to just keep it consistent and use what's already there.

What would a link like this...

<a href="my-page.html">My Page</a>

...look like to open my-page.html in the WP thickbox?

Answers (1)


Maor Barazany answers:

try to add the thickbox class and see if it works:

<a href="my-page.html" class="thickbox">My Page</a>

This class already loaded in the admin panel

Joe Calithia comments:

No luck. Already tried that. This link is not on the post edit page so I'm not sure if the same files are loaded throughout the entire WP back-end.

Maor Barazany comments:

Update, this will work for you:

Add these in your options page, in order to load the thickbox script and stylesheet:

wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');

Then, you shou open the link in frame and set the width and height you want:

<a href="my-page.html?TB_iframe=1&width=800&height=550" class="thickbox">My Page</a>

Joe Calithia comments:

Thank you Maor!