为什么wp_editor会走出容器?

时间:2019-01-25 16:25:44

标签: php wordpress

我已经搜索了很多东西,但是没有找到任何答案。我在前端使用wp_editor,但是它在div元素外部打印。

以下是屏幕截图 enter image description here

下面是我的代码

wp_editor( 
    $content = '', 
    $editor_id = 'ec_frontend_editor', 
    $settings =   array(
        'wpautop' => false, // use wpautop?
        'media_buttons' => true, // show insert/upload button(s)
        'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
        'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
        'tabindex' => '',
        'editor_css' => '', //  extra styles for both visual and HTML editors buttons, 
        'editor_class' => '', // add extra class(es) to the editor textarea
        'teeny' => false, // output the minimal editor config used in Press This
        'dfw' => true, // replace the default fullscreen with DFW (supported on the front-end in WordPress 3.4)
        'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
        'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
    )
)

1 个答案:

答案 0 :(得分:1)

为时已晚,但将来对某人会有所帮助。我遇到了同样的问题,因为我正在取弦:

$html = '';
$html .= wp_editor( $real_value, 'gg_contact_html_wp_editor', $wp_editor_settings );
echo $html;

然后我用以下代码替换我的代码:

<div class="container">
   wp_editor( $real_value, 'gg_contact_html_wp_editor', $wp_editor_settings );
</div>