In one of my wordpress plugins, I am using thickbox function to call another php file in the same plugin directory. The thickbox is displaying content as long as the content is from the same file, if I include another php file in the thickbox, it won't work. Please help.
Here is my code.
<?php
add_thickbox();
include plugin_dir_path(__FILE__) . '/my_php_file.php'; ?>
<div id="cnt-id" style="display:none;">
<h1><?php _e('Select an Item', 'txt-domain'); ?></h1>
<?php print_r($tpl_list);?>
</div>
The thickbox anchor link
<a href="#TB_inline?width=600&height=550&inlineId=cnt-id" class="thickbox">
<?php _e('Open thickbox', 'txt-domain'); ?>
</a>
So when the thickbox page is loaded, it only shows the h1 heading. the array which I am trying to print is just static array created in that included php file.
Any help will be highly appreciated.
Thanks
Just for someone in the similar situation. This is what I found as solution.
I used the absolution URL of the file on my the same location for thickbox with TB_iframe parameter. And I called a separate php file which is including another one with the array data.
That file which I didn't want to be directly accessible, I added the http_referer check via PHP to check if the ref url has wp-admin/post.php in there. That is not a rock solid hack proof but still helps somewhat.
Thanks