Support

Account

Home Forums Front-end Issues Create Front End Form using Shortcode Reply To: Create Front End Form using Shortcode

  • @kahil

    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 );