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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.