【问题标题】:TinyMCE element out of place on custom WordPress page自定义 WordPress 页面上的 TinyMCE 元素不合适
【发布时间】:2017-03-13 14:29:41
【问题描述】:

我正在 WordPress 中创建一个小型自定义测试管理员页面,当我插入 wp_editor 命令时,textarea 显示在工作区的顶部?

很遗憾,没有 CSS 能够将其恢复到正确位置。任何帮助或想法将不胜感激。

编辑:感谢您的快速回复,我正在编写下面非常简单的代码。如您所见,这没什么特别的,只是一个测试:

    function TstPlg_PageDisplay() {
      $MyPage = '
      <div class="wrap">
        <h2>TestPlugin</h2>
        <p>This is a test for the TestPlugin Page</p>
        <hr>
        <div>
          '.wp_editor('','MyTextArea').'
        </div>
      </div>';
      echo $MyPage;
    }
    function TstPlg_AddMenuPAge() {
      add_menu_page( 'TstPlg_PageDisplay', 'Test Plugin', 'manage_options', 'TstPlg_PageDisplay', 'TstPlg_PageDisplay');
    }
    add_action ('admin_menu', 'TstPlg_AddMenuPAge');

【问题讨论】:

    标签: wordpress tinymce editor admin positioning


    【解决方案1】:

    看起来(没有代码很难),回显了textarea,直接输出了插件代码。

    为避免这种情况,您可以使用 ob_start()、ob_get_clean() 并在您想要的位置回显结果 (textarea) 之后。

    【讨论】:

      猜你喜欢
      • 2020-07-03
      • 1970-01-01
      • 2015-03-20
      • 2012-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多