Php Wordpress管理员的Thickbox
我正试图以这种方式从类内部加载admin中的wp thickboxPhp Wordpress管理员的Thickbox,php,wordpress,Php,Wordpress,我正试图以这种方式从类内部加载admin中的wp thickbox function add_admin_scripts($hook) { global $post; if ($hook == 'post-new.php' || $hook == 'post.php') { if ('gm-weaver' === $post->post_type) { wp_enqueue_style('weaver'
function add_admin_scripts($hook) {
global $post;
if ($hook == 'post-new.php' || $hook == 'post.php') {
if ('gm-weaver' === $post->post_type) {
wp_enqueue_style('weaver', untrailingslashit(plugin_dir_url(__FILE__)) . '/../assets/css/weaver.css');
add_thickbox();
wp_enqueue_script('mm-weaver-script', untrailingslashit(plugin_dir_url(__FILE__)) . '/../assets/js/weaver.js', array('jquery', 'thickbox'), "1.0", TRUE);
}
}
}
thickbox正在工作,但未根据给定的内联参数重新调整大小
<a title="Title" href="#TB_inline?width=300&height=500&inlineId=my-content-id" id="insert-my-media" class="button thickbox">C media</a>'
. '<div id="my-content-id" style="display:none;">
<form>
<input type="text">
</form>
</div>
在add_admin_脚本($hook){…}中,它可以在admin上正常工作,而不是add_thickbox()
wp_enqueue_script('mm-weaver-script', untrailingslashit(plugin_dir_url(__FILE__)) . '/../assets/js/thickbox.js', array('jquery'), TRUE)