wp_editor() displays a simple text box for each post
It’s not actually a “simple text box” =), because wp_editor()
allows you to convert/turn textarea
to a rich-text/WYSIWYG editor using the TinyMCE library.
I want to let users add/edit content from the front end
Because you’re using Advanced Custom Fields (ACF), then there’s an easy way to do that, which is basically by using acf_form()
. And based on the example on this page, here’s a sample Page template you can use with the Twenty Seventeen theme:
<?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();
Hope that helps!