wp\\u editor()为每篇文章显示一个简单的文本框
它实际上不是一个“简单文本框”=),因为wp_editor()
允许您转换/转动textarea
使用富文本/所见即所得编辑器TinyMCE library.
我想让用户从前端添加/编辑内容
因为您使用的是高级自定义字段(ACF),所以an easy way to do that, 基本上是通过使用acf_form()
. 并基于上的示例this page, 下面是一个示例页面模板,您可以将其用于2017主题:
<?php
/**
* Template Name: ACF Create Post
*/
acf_form_head();
get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header" style="width: 100%;">
<?php the_title( \'<h1 class="entry-title">\', \'</h1>\' ); ?>
<?php twentyseventeen_edit_link( get_the_ID() ); ?>
</header><!-- .entry-header -->
<div class="entry-content" style="width: 100%;">
<?php
the_content();
acf_form( array(
\'post_id\' => \'new_post\',
\'field_groups\' => array( 1858 ),
\'submit_value\' => \'Create Post\',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php endwhile; ?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .wrap -->
<?php get_footer();
希望有帮助!