Support

Account

Home Forums Front-end Issues Front end form titles question

Helping

Front end form titles question

  • hi guys,

    I’m creating a form on the front end. I have a few questions.

    I’m following this code from the tutorial.

    // Create a new post
    $post = array(
    ‘post_status’ => ‘draft’ ,
    ‘post_title’ => ‘A title, maybe a $_POST variable’ ,
    ‘post_type’ => ‘post’ ,
    );

    I need to add an input field so the user can put the title. How can I achieve that? Where do I put the input field?

    <div id=”content” role=”main”>
    <?php

    $args = array(
    ‘post_id’ => ‘new’,
    ‘field_groups’ => array( 123 )
    );

    acf_form( $args );

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

    #####2nd question :

    How can I change the button? it says “update”. I like to change to “create new post”

    ####3rd question : is it possible make the form go to a pending section and that only the admin approves it after?

    thanks in advance!

  • Hi @jimmy

    1. How to add an extra field
    You can do this by passing in extra HTML to the $args array like so:

    
    'html_before_fields' => '<input type="text" name="post_title" />'
    

    2. Change the button text
    Again, you can pass this in through the args:

    
    'submit_value' => 'Make new thing!'
    

    3. Pending
    This is out of the scope of ACF, however, your above code will create a draft post which is kind of the same thing as pending. You would then need an Admin to edit and save the draft to publish it onto the site

    Does that help?

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

The topic ‘Front end form titles question’ is closed to new replies.