Ninja Forms is a free WordPress plugin or easy tool for creating forms. It is a powerful tool through which you can create forms via drag and drop feature. In this article we are creating a short code for “All Fields” without showing colon “:” in email.
Basically ninja form fixed the colon “:” in their mail template for “All Fields” short code.
Copy below code and paste in theme’s function.php file.
function my_nf_all_fields_shortcode( $atts, $content = '' ) {
global $ninja_forms_fields, $ninja_forms_processing;if ( ! isset ( $ninja_forms_processing ) )
return false;$html = isset ( $atts['html'] ) ? $atts['html'] : 1;
if ( 1 == $html ) {
// Generate our "all fields" table for use as a JS var.
$field_list = '<table><tbody>';
} else {
$field_list = '';
}
foreach ( $ninja_forms_processing->get_all_fields() as $field_id => $user_value ) {
if ( ! $user_value )
continue;$field = $ninja_forms_processing->get_field_settings( $field_id );
$type = $field['type'];
if ( ! isset ( $ninja_forms_fields[ $type ] ) || ! $ninja_forms_fields[ $type ]['process_field'] )
continue;$value = apply_filters( 'nf_all_fields_field_value', ninja_forms_field_shortcode( array( 'id' => $field_id ) ), $field_id );
if( isset( $field[ 'data' ][ 'admin_label' ] ) && $field[ 'data' ][ 'admin_label' ] ){
$label = $field[ 'data' ][ 'admin_label' ];
} else {
$label = $field['data']['label'];
}
$label = strip_tags( apply_filters( 'nf_all_fields_field_label', $label, $field_id ) );if ( 1 == $html ) {
$field_list .= '<tr id="ninja_forms_field_' . $field_id . '"><td>' . $label .'</td><td>' . $value . '</td></tr>';
} else {
$field_list .= $label . ' - ' . $value . "\r\n";
}
}if ( 1 == $html )
$field_list .= '</tbody></table>';return apply_filters( 'nf_all_fields_table', $field_list, $ninja_forms_processing->get_form_ID() );
}
add_shortcode( 'ninjaformsallfields', 'my_nf_all_fields_shortcode' );
Code Where we have have made changes.
$field_list .= '<tr id="ninja_forms_field_' . $field_id . '"><td>' . $label .'</td><td>' . $value . '</td></tr>';
Shortcode
[ninjaformsallfields]
Use above short code in “Email & Action” tab of Ninja Forms.