Support

Account

Home Forums Front-end Issues Display form on front-end

Solved

Display form on front-end

  • Hi

    I want to display the form fields on a front-end page, exactly the same way they appear below a post type. When someone fill in a form and submit, a new post should be created.I tried acf_form(), but I don’t see the fields at all.

  • Hi @amadalmatian

    Thanks for the mail.

    Have you correctly set the acf_form options and using acf_form_head method?

    Kindly share with us the sample code that you using with the acf_form so that we can assist in
    debugging.

    Hope to hear from you soon.

  • Hi James

    This is what I have….

    <?php /* Template Name: Application ENglish */ ?>

    <php? acf_form_head(); ?>

    <?php get_header(); ?>

    <div id=”primary”>
    <div id=”content” role=”main”>

    <?php /* The loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <h1><?php the_title(); ?></h1>

    <?php the_content(); ?>

    <p>My custom field: <?php the_field(‘my_custom_field’); ?></p>

    <?php acf_form(array(
    ‘post_id’ => ‘toets’,
    ‘new_post’ => array(
    ‘post_type’ => ‘toets’,
    ‘post_status’ => ‘publish’
    ),
    ‘submit_value’ => ‘Create a new toets’
    )); ?>

    <?php endwhile; ?>

    </div><!– #content –>
    </div><!– #primary –>

    <?php get_footer(); ?>

  • Hi @amadalmatian

    There are a number of errors on your code, please try this copy”

    <?php /* Template Name: Application ENglish */ ?>
    
    <php acf_form_head(); ?>
    
    <?php get_header(); ?>
    
    <div id=”primary”>
    <div id=”content” role=”main”>
    
    <?php /* The loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
    <h1><?php the_title(); ?></h1>
    
    <?php the_content(); ?>
    
    <p>My custom field: <?php the_field(‘my_custom_field’); ?></p>
    
    <?php acf_form(); ?>
    
    <?php endwhile; ?>
    
    </div><!– #content –>
    </div><!– #primary –>
    
    <?php get_footer(); ?>

    This will create a form to edit the current post

  • Hi

    Thanks works, thanks so much.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Display form on front-end’ is closed to new replies.