dongyu3967 2017-12-18 13:27
浏览 59

让Visual Editor使用WordPress wp编辑器

I am using wp editor to output a WYSIWIG editor in a custom field. I am using the following function:

/**
 * Output native WordPress WYSIWIG editor
 *
 * media_buttons and quicktags are set to true by default
 *
 * @param $helper_text
 * @param $id
 * @param bool $media_buttons
 * @param bool $quicktags
 * @return mixed
 */
function native_wysiwig_editor($helper_text, $id, $media_buttons = true, $quicktags = true) {
    $content= get_post_meta( get_the_id(), $id, true );
    $settings = ['media_buttons' => $media_buttons,'quicktags' => $quicktags ];
    if( strlen( stripslashes($content)) == 0) $content = $helper_text;
    $editor_id = $id;
    $wywisig = wp_editor( $content, $editor_id, $settings );

    return $wywisig;
}

and I reference it like such:

native_wysiwig_editor('helper text here', '_intro_product_test', false);

I am confused looking at the doc on how to reference the wp_editor how to actually get it to show the normal "Visual Editor" instance that plays nice to the frontend user. What am I missing? Any help would be greatly appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 目详情-五一模拟赛详情页
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line