• Resolved cayesd

    (@cayesd)


    I have created a post submission form which allows users to generate content and submit it as a blog post. When a user submits the information the post goes to the right page, however when you click on there is only the featured image and post exerpt that is displayed. I was wondering if there was a way to display all the form fields so they all display when the post is opened?

Viewing 1 replies (of 1 total)
  • Plugin Author Jared Atchison

    (@jaredatch)

    This was solved through our in-house support channel with a custom snippet (user owns a paid license) – ??

    Snippet below for reference!

    
    /**
     * Customize the post content created by the Post Submissions addon.
     *
     */
    function wpf_post_submission_custom_content( $post_id, $fields, $form_data, $entry_id ) {
    
    	$content = '';
    
    	foreach( $fields as $field ) {
    		if ( !empty( $field['value'] ) ) {
    			$content .= '<p class="wpf-field">';
    				if ( !empty( $field['name'] ) ) {
    					$content .= '<strong>' . $field['name'] . '</strong><br>';
    				}
    				$content .= apply_filters( 'wpforms_html_field_value', $field['value'], $field, '', '' );
    			$content .= '</p>';
    		}
    	}
    
    	remove_filter('content_save_pre', 'wp_filter_post_kses');
    	remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    
    	$post = array(
    		'ID'           => $post_id,
    		'post_content' => $content,
    	);
    	wp_update_post( $post );
    
    	add_filter('content_save_pre', 'wp_filter_post_kses');
    	add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    
    }
    add_action( 'wpforms_post_submissions_process', 'wpf_post_submission_custom_content', 10, 4 );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying all form fields of the post submission’ is closed to new replies.