Support

Account

Home Forums Front-end Issues Shortcode ACF frontend form Reply To: Shortcode ACF frontend form

  • Hi @buylov

    Please learn the code carefully. Also, please learn more about creating a shortcode here: https://codex.wordpress.org/Shortcode_API. You also need to learn about PHP here: http://www.w3schools.com/php/. If you don’t want or don’t have time to learn them, please hire a developer to help you out with it. I’d recommend looking for one on https://studio.envato.com/ or https://www.upwork.com/.

    shortcode_atts() is used to add default values to the attributes. So you need to set the default values from acf_form() in this function. Something like this:

    $atts = shortcode_atts( array(
        'acfposttype' => 'post',
        ...

    After that, you can get the attributes using the key like this: $atts['acfposttype'], so it looks like this:

    acf_form(array(
        'post_title' => $atts['acfposttitle'] === 'true'? true: false,
        'new_post'		=> array(
            'post_type'	=> $atts['acfposttype'],
            'post_status'	=> 'publish',
        ),
        ...

    I hope this makes sense.