Ok so here's the deal. Using the code below, I have created a custom button in the tinyMCE editor which opens a modal window and loads a php file I created. This is NOT a plugin for Wordpress, I've built the functionality directly into my theme.
It works perfectly on my local environment (Ubuntu running LAMP with a vhost file loading the site as wordpress.loc if any of this helps) but on my production server, running cpanel the modal window cant seem to find the php file. It 404s. So I guess the WP routing system is getting in the way.. but I'm having this issue with both the latest version of WP and tinyMCE and the last.
Here is how Im setting it up:
function register_button($buttons) {
array_push($buttons,"|" ,"kjdShortCodeInjection");
return $buttons;
}
function add_plugin($plugin_array) {
$admin_dir = get_stylesheet_directory_uri().'/lib/admin';
$mce_plugin_js = $admin_dir.'/functions/shortcode-injector/mcePlugin.js';
$plugin_array['kjdShortCodeInjection'] = $mce_plugin_js;
return $plugin_array;
}
add_filter('mce_external_plugins', 'add_plugin');
add_filter('mce_buttons', 'register_button');
And the JS which I need for tinyMCE:
init : function(ed, url) {
ed.addCommand('mcekjdShortCodeInjection', function() {
ed.windowManager.open({
file : url+'/shortcode_window.php',
title: "Select a shortcode",
popup_css: "bootstrap.css",
width : 900 + ed.getLang('kjdShortCodeInjection.delta_width', 0),
height : 600 + ed.getLang('kjdShortCodeInjection.delta_height', 0),
inline : 1
}, {
plugin_url : url // Plugin absolute URL
});
});
Almost every example or tutorial I've found has the button added as a plugin, and therefor is using WP_PLUGIN_URL
or plugins_url
Is there a way I can get the accessible absolute path?