Home › Forums › Front-end Issues › Create Front End Form using Shortcode › Reply To: Create Front End Form using Shortcode
Thanks for all the feedback. You should probably jump over to the github repo tho if you want to take things further so we don’t highjack this thread.
As for styling you have two options. You can set the id
parameter to get a custom ID for the form. And you can set extra classes on the form element by passing it to the form_attributes
parameter as an array.
[show_acf_form id="mycustomid" form_attributes="class|mycustomclass"]
As for the email alert I kinda think it’s outside the scope of what an ACF Form Shortcode plugin should do. You can however easily create the functionality yourself. Here’s a working (not tested) example using your field keys. Just update the “mycptslug” strings.
<?php
function send_email_on_submit( $post_id, $post, $update ){
// If this is just a revision, don't send the email.
if ( wp_is_post_revision( $post_id ) )
return;
$post_title = get_the_title( $post_id );
$post_url = get_permalink( $post_id );
$subject = __('A design has been approved');
$message = 'A design has been approved:\n\n';
$message .= 'Name: ' . get_field('field_57210e7e7a217', $post_id) . '\n\n';
$message .= 'Email: ' . get_field('field_573b9511ba9f5', $post_id) . '\n\n';
$message .= $post_title . ": " . $post_url;
// Send email to admin.
wp_mail( get_option('admin_email'), $subject, $message );
}
add_action( 'save_post_mycptslug', 'send_email_on_submit', 10, 3 );
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’re hard at work on ACF 6.1, and Beta 1 is now available 🚀
— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.