Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes you’ll probably need a rel tag on there to..

    eg.

    rel="thickbox"

    Thread Starter juri003

    (@juri003)

    Hey t31os_

    Thanks for your reply. Unfortunately that doesn’t do the trick. It seems there is really a some kind of hack necessary to support content other than images.

    Anyone?

    Been a while since i done it, but i’ve used thickbox to display php files, so i know it’s possible to use it for other things, i’ll go see if i’ve still got the code i used and make a suggestion.

    Checked whilst i was writing the reply, here’s the attachment.php from a theme where i used thickbox to handle the display of attachments, some were php/phps files, others were images.

    https://wordpress.pastebin.com/pRPCYP9Y

    I also had to add php and phps to the whitelist for allowed mime types in order to upload them, which was done with the following.

    function custom_upload_mimes ( $mimes ) {
    	$mimes['php'] = 'application/x-httpd-php-source';
    	$mimes['phps'] = 'application/x-httpd-php-source';
    	return $mimes;
    }
    add_filter( 'upload_mimes' , 'custom_upload_mimes' );

    On top of that i also forced a content type in the upload directory(via htaccess file in the upload folder) when a file matched .php or .phps, i don’t have that code backed up but it looked like something along these lines though.

    <FilesMatch "\.(php|phps)$">
    Content-Type: application/x-httpd-php-source
    </FilesMatch>

    Beyond that, i’m not really sure if there was anything else i did(was 3 months ago and i’m no longer using the code), but perhaps you can take something away from the code i’ve provided.

    EDIT: Additionally i added some URL rewrites to swap out the real file locations for some custom URLs, but that doesn’t play any part in the code working(that was just a personal touch so people couldn’t query the php files directly, etc..)

    Thread Starter juri003

    (@juri003)

    Ha!

    There was a very small but helpfull piece of code there! I just needed to add this behind the source document:

    ?TB_iframe=true

    Now I only need to get rid of those nasty scrolls but I’ll probably manage that!

    THANKS!!!

    Had a feeling it might be the TB_Frame part you needed, but thought it might serve you better to just post up the code so you pick from it what you need.

    Happy to help in any case.. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Use Thickbox to load html or php’ is closed to new replies.