Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress管理员的Thickbox_Php_Wordpress - Fatal编程技术网

Php Wordpress管理员的Thickbox

Php 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'

我正试图以这种方式从类内部加载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', 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()

  • 添加_thickbox()以加载管理员的thickbox.js有什么问题
  • 在wp admin中使用thickbox的正确方法是什么
  • wp_enqueue_script('mm-weaver-script', untrailingslashit(plugin_dir_url(__FILE__)) . '/../assets/js/thickbox.js', array('jquery'), TRUE)