Below, you’ll find a detailed guide on how to add the Contact Form Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Contact Form Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Contact Form Plugin and the shortcodes it provides:

"Contact Form by BestWebSoft is a robust WordPress plugin designed to create advanced contact us forms. Highly customizable, it simplifies form building for seamless user interactions."
- [bws_contact_form]
Contact Form [bws_contact_form] Shortcode
The ‘bws_contact_form’ shortcode from the Contact Form Plugin is used to display a contact form on a WordPress site. It allows users to customize form fields like name, email, subject, and message. It also supports file attachments and GDPR compliance.
Shortcode: [bws_contact_form]
Parameters
Here is a list of all possible bws_contact_form shortcode parameters and attributes:
id
– Unique identifier of the contact form.lang
– Language of the displayed contact form.
Examples and Usage
Basic example – Display a contact form using its ID
[bws_contact_form id=1 /]
Advanced example – Display a contact form by specifying its ID and the language. The form will first try to load by ID, but if not found, it will try to load by language.
[bws_contact_form id=1 lang='en' /]
Advanced example – Display a contact form by specifying its ID and the language. If the language is not available, the form will load in the default language.
[bws_contact_form id=1 lang='fr' /]
PHP Function Code
In case you have difficulties debugging what causing issues with [bws_contact_form]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'bws_contact_form', 'cntctfrm_display_form' );
Shortcode PHP function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | function cntctfrm_display_form( $atts = array ( 'lang' => 'default' ) ) { global $cntctfrm_error_message , $cntctfrm_options , $cntctfrm_plugin_info , $cntctfrm_result , $cntctfrmmlt_ide , $cntctfrmmlt_active_plugin , $cntctfrm_form_count , $cntctfrm_related_plugins , $cntctfrm_stile_options ; if ( empty ( $cntctfrm_related_plugins ) ) cntctfrm_related_plugins(); $contact_form_multi_active = cntctfrm_check_cf_multi_active(); if ( ! wp_script_is( 'cntctfrm_frontend_script' , 'registered' ) ) wp_register_script( 'cntctfrm_frontend_script' , plugins_url( 'js/cntctfrm.js' , __FILE__ ), array ( 'jquery' ), $cntctfrm_plugin_info [ "Version" ], true ); $cntctfrm_form_count = empty ( $cntctfrm_form_count ) ? 1 : ++ $cntctfrm_form_count ; $form_countid = ( $cntctfrm_form_count == 1 ? '' : '_' . $cntctfrm_form_count ); $content = "" ; /* Get options for the form with a definite identifier */ require_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( $contact_form_multi_active ) { extract( shortcode_atts( array ( 'id' => $cntctfrmmlt_ide , 'lang' => 'default' ), $atts ) ); if ( isset( $atts [ 'id' ] ) ) { cntctfrm_settings( $atts [ 'id' ] ); $cntctfrm_options = get_option( 'cntctfrmmlt_options_' . $atts [ 'id' ] ); $options_name = 'cntctfrmmlt_options_' . $atts [ 'id' ]; /* if no options with the specified id */ if ( ! $cntctfrm_options ) { $cntctfrm_options = get_option( 'cntctfrmmlt_options' ); $options_name = 'cntctfrmmlt_options' ; } elseif ( empty ( $options_name ) ) { $options_name = 'cntctfrmmlt_options' ; } } else { cntctfrm_settings(); if ( 'pro' == $contact_form_multi_active && $multi_options_main = get_option( 'cntctfrmmltpr_options_main' ) ) { /**/ } else { $multi_options_main = get_option( 'cntctfrmmlt_options_main' ); } if ( ! empty ( $multi_options_main ) ) { reset( $multi_options_main [ 'name_id_form' ] ); $id = key( $multi_options_main [ 'name_id_form' ] ); $cntctfrm_options = get_option( 'cntctfrmmlt_options_' . $id ); $options_name = 'cntctfrmmlt_options_' . $id ; if ( empty ( $cntctfrm_options ) ) { $cntctfrm_options = get_option( 'cntctfrmmlt_options' ); $options_name = 'cntctfrmmlt_options' ; } } else { $options_name = 'cntctfrmmlt_options' ; } } } else { cntctfrm_settings(); $cntctfrm_options = get_option( 'cntctfrm_options' ); extract( shortcode_atts( array ( 'lang' => 'default' ), $atts ) ); $options_name = 'cntctfrm_options' ; } $cntctfrm_stile_options [ $cntctfrm_form_count ] = $options_name ; /* check lang and replace with en default if need */ foreach ( $cntctfrm_options as $key => $value ) { if ( is_array ( $value ) && array_key_exists ( 'default' , $value ) && ( ! array_key_exists ( $lang , $value ) || ( isset( $cntctfrm_options [ $key ][ $lang ] ) && $cntctfrm_options [ $key ][ $lang ] == '' ) ) ) { $cntctfrm_options [ $key ][ $lang ] = $cntctfrm_options [ $key ][ 'default' ]; } } $page_url = esc_url( add_query_arg( array () ) . '#cntctfrm_contact_form' ); /* If contact form submited */ $default_value = '' ; $form_submited = isset( $_POST [ 'cntctfrm_form_submited' ] ) ? sanitize_key( $_POST [ 'cntctfrm_form_submited' ] ) : 0; $name = ( isset( $_POST [ 'cntctfrm_contact_name' ] ) && $cntctfrm_form_count == $form_submited ) ? sanitize_text_field( wp_unslash( $_POST [ 'cntctfrm_contact_name' ] ) ) : apply_filters( 'cntctfrm_default_name_check' , $default_value ); $address = ( isset( $_POST [ 'cntctfrm_contact_address' ] ) && $cntctfrm_form_count == $form_submited ) ? sanitize_text_field( wp_unslash( $_POST [ 'cntctfrm_contact_address' ] ) ) : "" ; $email = ( isset( $_POST [ 'cntctfrm_contact_email' ] ) && $cntctfrm_form_count == $form_submited ) ? sanitize_email( wp_unslash( $_POST [ 'cntctfrm_contact_email' ] ) ) : apply_filters( 'cntctfrm_default_email_check' , $default_value ); $subject = ( isset( $_POST [ 'cntctfrm_contact_subject' ] ) && $cntctfrm_form_count == $form_submited ) ? sanitize_text_field( wp_unslash( $_POST [ 'cntctfrm_contact_subject' ] ) ) : apply_filters( 'cntctfrm_default_subject_check' , $default_value ); $message = ( isset( $_POST [ 'cntctfrm_contact_message' ] ) && $cntctfrm_form_count == $form_submited ) ? sanitize_text_field( wp_strip_all_tags( wp_unslash( $_POST [ 'cntctfrm_contact_message' ] ) ) ) : apply_filters( 'cntctfrm_default_message_check' , $default_value ); $phone = ( isset( $_POST [ 'cntctfrm_contact_phone' ] ) && $cntctfrm_form_count == $form_submited ) ? sanitize_text_field( wp_unslash( $_POST [ 'cntctfrm_contact_phone' ] ) ) : "" ; $send_copy = ( isset( $_POST [ 'cntctfrm_contact_send_copy' ] ) && $cntctfrm_form_count == $form_submited ) ? $_POST [ 'cntctfrm_contact_send_copy' ] : "" ; $gdpr = ( isset( $_POST [ 'cntctfrm_contact_gdpr' ] ) && $cntctfrm_form_count == $form_submited ) ? $_POST [ 'cntctfrm_contact_gdpr' ] : "" ; /* If it is good */ if ( true === $cntctfrm_result && $cntctfrm_form_count == $form_submited ) { if ( 1 == $cntctfrm_options [ 'action_after_send' ] ) { $content .= '<div id="cntctfrm_contact_form' . $form_countid . '"><div id="cntctfrm_thanks">' . $cntctfrm_options [ 'thank_text' ][ $lang ] . '</div></div>' ; } else { $content .= "<script type='text/javascript'>window.location.href = '" . $cntctfrm_options ['redirect_url '] . "' ;</script>"; } } elseif ( false === $cntctfrm_result && $cntctfrm_form_count == $form_submited ) { /* If email not be delivered */ $cntctfrm_error_message [ 'error_form' ] = esc_html__( "Sorry, email message could not be delivered." , 'contact-form-plugin' ); } if ( true !== $cntctfrm_result || $cntctfrm_form_count != $form_submited ) { $classes = ( $cntctfrm_options [ 'layout' ] === 1 ) ? ' cntctfrm_one_column' : ' cntctfrm_two_columns' ; $classes .= is_rtl() ? ' cntctfrm_rtl' : ' cntctfrm_ltr' ; $classes .= ( 'custom' != $cntctfrm_options [ 'width' ][ 'type' ] ) ? ' cntctfrm_width_default' : ' cntctfrm_width_custom' ; /* Output form */ $content .= '<form method="post" id="cntctfrm_contact_form' . $form_countid . '" class="cntctfrm_contact_form' . $classes . '"' ; $content .= ' action="' . $page_url . $form_countid . '" enctype="multipart/form-data">' ; if ( isset( $cntctfrm_error_message [ 'error_form' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . ( isset( $cntctfrm_result [ 'error_lmtttmpts' ] ) ? $cntctfrm_result [ 'error_lmtttmpts' ] : $cntctfrm_error_message [ 'error_form' ] ) . '</div>' ; } if ( ! isset( $id ) ) { $cntctfrm_ordered_fields = cntctfrm_get_ordered_fields(); } else { $cntctfrm_ordered_fields = cntctfrm_get_ordered_fields( $id ); } for ( $i = 1; $i <= $cntctfrm_options [ 'layout' ]; $i ++ ) { $column = ( $i == 1 ) ? 'first_column' : 'second_column' ; $content .= '<div id="cntctfrm_' . $column . '" class="cntctfrm_column">' ; $custom_fields = apply_filters( 'cntctfrm_custom_fields' , $atts ); foreach ( $cntctfrm_ordered_fields [ $column ] as $cntctfrm_field ) { switch ( $cntctfrm_field ) { case 'cntctfrm_contact_name' : if ( 1 == $cntctfrm_options [ 'display_name_field' ] ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_name_wrap"' . apply_filters( 'cntctfrm_visibility' , 'namecontact' ) . '>' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_name" > <label for = "cntctfrm_contact_name' . $form_countid . '" > ' . $cntctfrm_options[' name_label '][ $lang ] . ( $cntctfrm_options[' required_name_field '] == 1 ? ' <span class = "required" > ' . $cntctfrm_options[' required_symbol '] . ' </span></label> ' : ' </label>' ); $content .= '</div>' ; if ( isset( $cntctfrm_error_message [ 'error_name' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_name' ] . '</div>' ; } $content .= '<div class = "cntctfrm_input cntctfrm_input_name" > <input ' . apply_filters( ' cntctfrm_readonly ', ' namecontact ' ) . ' class = "text" type= "text" size= "40" pattern= "^[\p{L}\p{M}]{3,}(\s\p{M}*\p{L}+)*" title= "' . __( 'Please enter only letters at least 3 characters, words seperated by spaces', 'contact-form-plugin' ) . '" value= "' . $name . '" name= "cntctfrm_contact_name" id= "cntctfrm_contact_name' . $form_countid . '" />'; $content .= '</div>' ; $content .= '</div>' ; } break ; case 'cntctfrm_contact_address' : if ( 1 == $cntctfrm_options [ 'display_address_field' ] ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_address_wrap">' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_address" > <label for = "cntctfrm_contact_address' . $form_countid . '" > ' . $cntctfrm_options[' address_label '][ $lang ] . ( $cntctfrm_options[' required_address_field '] == 1 ? ' <span class = "required" > ' . $cntctfrm_options[' required_symbol '] . ' </span></label> ' : ' </label> ' ) . ' </div>'; if ( isset( $cntctfrm_error_message [ 'error_address' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_address' ] . '</div>' ; } $content .= '<div class = "cntctfrm_input cntctfrm_input_address" > <input class = "text" type= "text" size= "40" pattern= "([\p{L}\p{M}\s0-9]){1,120}" title= "' . __( 'Please enter only letters and numbers at least 3 characters, words seperated by spaces', 'contact-form-plugin' ) . '" value= "' . $address . '" name= "cntctfrm_contact_address" id= "cntctfrm_contact_address' . $form_countid . '" />'; $content .= '</div>' ; $content .= '</div>' ; } break ; case 'cntctfrm_contact_email' : $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_email_wrap"' . apply_filters( 'cntctfrm_visibility' , 'email' ) . '>' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_email" > <label for = "cntctfrm_contact_email' . $form_countid . '" > ' . $cntctfrm_options[' email_label '][ $lang ] . ( $cntctfrm_options[' required_email_field '] == 1 ? ' <span class = "required" > ' . $cntctfrm_options[' required_symbol '] . ' </span></label> ' : ' </label> ' ) . ' </div>'; if ( isset( $cntctfrm_error_message [ 'error_email' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_email' ] . '</div>' ; } $content .= '<div class = "cntctfrm_input cntctfrm_input_email" > <input ' . apply_filters( ' cntctfrm_readonly ', ' email ' ) . ' class = "text" type= "email" size= "40" value= "' . $email . '" name= "cntctfrm_contact_email" id= "cntctfrm_contact_email' . $form_countid . '" />'; $content .= '</div>' ; $content .= '</div>' ; break ; case 'cntctfrm_contact_phone' : if ( 1 == $cntctfrm_options [ 'display_phone_field' ] ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_phone_wrap">' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_phone" > <label for = "cntctfrm_contact_phone' . $form_countid . '" > ' . $cntctfrm_options[' phone_label '][ $lang ] . ( $cntctfrm_options[' required_phone_field '] == 1 ? ' <span class = "required" > ' . $cntctfrm_options[' required_symbol '] . ' </span></label> ' : ' </label> ' ) . ' </div>'; if ( isset( $cntctfrm_error_message [ 'error_phone' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_phone' ] . '</div>' ; } $content .= '<div class = "cntctfrm_input cntctfrm_input_phone" > <input class = "text" type= "text" size= "40" value= "' . $phone . '" pattern= "[0-9]{6,}" title= "' . __( 'Please enter only numbers at least 6 characters', 'contact-form-plugin' ) . '" name= "cntctfrm_contact_phone" id= "cntctfrm_contact_phone' . $form_countid . '" />'; $content .= '</div>' ; $content .= '</div>' ; } break ; case 'cntctfrm_contact_subject' : $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_subject_wrap"' . apply_filters( 'cntctfrm_visibility' , 'subject' ) . '>' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_subject" > <label for = "cntctfrm_contact_subject' . $form_countid . '" > ' . $cntctfrm_options[' subject_label '][ $lang ] . ( $cntctfrm_options[' required_subject_field '] == 1 ? ' <span class = "required" > ' . $cntctfrm_options[' required_symbol '] . ' </span></label> ' : ' </label> ' ) . ' </div>'; if ( isset( $cntctfrm_error_message [ 'error_subject' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_subject' ] . '</div>' ; } $content .= '<div class = "cntctfrm_input cntctfrm_input_subject" > <input ' . apply_filters( ' cntctfrm_readonly ', ' subject ' ) . ' pattern= "^[\p{M}\p{L}]{3,}(\s\p{M}*\p{L}+)*" title= "' . __( 'Please enter only letters at least 3 characters, words seperated by spaces', 'contact-form-plugin' ) . '" class = "text" type= "text" size= "40" value= "' . $subject . '" name= "cntctfrm_contact_subject" id= "cntctfrm_contact_subject' . $form_countid . '" />'; $content .= '</div>' ; $content .= '</div>' ; break ; case 'cntctfrm_contact_message' : $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_message_wrap"' . apply_filters( 'cntctfrm_visibility' , 'message' ) . '>' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_message" > <label for = "cntctfrm_contact_message' . $form_countid . '" > ' . $cntctfrm_options[' message_label '][ $lang ] . ( $cntctfrm_options[' required_message_field '] == 1 ? ' <span class = "required" > ' . $cntctfrm_options[' required_symbol '] . ' </span></label> ' : ' </label> ' ) . ' </div>'; if ( isset( $cntctfrm_error_message [ 'error_message' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_message' ] . '</div>' ; } $content .= '<div class = "cntctfrm_input cntctfrm_input_message" > <textarea ' . apply_filters( ' cntctfrm_readonly ', ' message ' ) . ' rows= "5" cols= "30" name= "cntctfrm_contact_message" id= "cntctfrm_contact_message' . $form_countid . '" > ' . $message . ' </textarea>'; $content .= '</div>' ; $content .= '</div>' ; break ; case 'cntctfrm_contact_attachment' : if ( 1 == $cntctfrm_options [ 'attachment' ] ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_attachment_wrap">' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_attachment" > <label for = "cntctfrm_contact_attachment' . $form_countid . '" > ' . $cntctfrm_options[' attachment_label '][ $lang ] . ' </label> </div>'; if ( isset( $cntctfrm_error_message [ 'error_attachment' ] ) && $cntctfrm_form_count == $form_submited ) { $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_attachment' ] . '</div>' ; } if ( 1 == $cntctfrm_options [ 'active_multi_attachment' ] ) { $content .= '<div class = "cntctfrm_input cntctfrm_input_attachment" > <input type= "file" multiple name= "cntctfrm_contact_attachment[]" id= "cntctfrm_contact_attachment' . $form_countid . '" ' . ( isset( $cntctfrm_error_message[' error_attachment '] ) ? "class=' error '": "" ) . ' />'; } else { $content .= '<div class = "cntctfrm_input cntctfrm_input_attachment" > <input type= "file" name= "cntctfrm_contact_attachment" id= "cntctfrm_contact_attachment' . $form_countid . '" ' . ( isset( $cntctfrm_error_message[' error_attachment '] ) ? "class=' error '": "" ) . ' />'; } $content .= '</div>' ; if ( 1 == $cntctfrm_options [ 'attachment_explanations' ] ) { $content .= '<label class="cntctfrm_contact_attachment_extensions"><br />' . $cntctfrm_options [ 'attachment_tooltip' ][ $lang ] . '</label>' ; } $content .= '</div>' ; } break ; case 'cntctfrm_contact_send_copy' : if ( 1 == $cntctfrm_options [ 'send_copy' ] ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_attachment_wrap">' ; $content .= '<div class = "cntctfrm_checkbox cntctfrm_checkbox_send_copy" > <input type= "checkbox" value= "1" name= "cntctfrm_contact_send_copy" id= "cntctfrm_contact_send_copy" ' . ( $send_copy == ' 1 ' ? ' checked= "checked" ' : "" ) . ' /> <label for = "cntctfrm_contact_send_copy" > ' . $cntctfrm_options[' send_copy_label '][ $lang ] . ' </label>'; $content .= '</div>' ; $content .= '</div>' ; } break ; case 'cntctfrm_contact_gdpr' : if ( 1 == $cntctfrm_options [ 'gdpr' ] ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_attachment_wrap">' ; $content .= '<div class = "cntctfrm_checkbox cntctfrm_checkbox_gdpr" > <input type= "checkbox" value= "" required name= "cntctfrm_contact_gdpr" id= "cntctfrm_contact_gdpr" ' . ( $gdpr == ' 1 ' ? ' checked= "checked" ' : "" ) . ' /> <label for = "cntctfrm_contact_gdpr" > ' . $cntctfrm_options[' gdpr_label '][ $lang ] . ' </label>'; if ( ! empty ( $cntctfrm_options [ 'gdpr_link' ] ) ) { $content .= ' ' . '<a target="_blank" href="' . $cntctfrm_options [ 'gdpr_link' ] . '">' . $cntctfrm_options [ 'gdpr_text_button' ][ $lang ] . '</a>' ; } else { $content .= '<span>' . ' ' . $cntctfrm_options [ 'gdpr_text_button' ][ $lang ] . '</span>' ; } $content .= '</div>' ; $content .= '</div>' ; } break ; case 'cntctfrm_subscribe' : if ( has_filter( 'sbscrbr_cntctfrm_checkbox_add' ) && ( ( ! $contact_form_multi_active && ! empty ( $cntctfrm_related_plugins [ 'subscriber' ][ 'options' ][ 'contact_form' ] ) ) || ! empty ( $cntctfrm_options [ 'display_subscribe' ] ) ) ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_checkbox_subscribe_wrap">' ; $content .= '<div class="cntctfrm_checkbox cntctfrm_checkbox_subscribe">' ; $cntctfrm_sbscrbr_checkbox = apply_filters( 'sbscrbr_cntctfrm_checkbox_add' , array ( 'form_id' => 'cntctfrm_' . $cntctfrm_form_count , 'display' => ( isset( $cntctfrm_error_message [ 'error_sbscrbr' ] ) && $cntctfrm_form_count == $form_submited ) ? $cntctfrm_error_message [ 'error_sbscrbr' ] : false ) ); if ( isset( $cntctfrm_sbscrbr_checkbox [ 'content' ] ) ) { $content .= $cntctfrm_sbscrbr_checkbox [ 'content' ]; } $content .= '</div>' ; $content .= '</div>' ; } break ; case 'cntctfrm_captcha' : $removed_filters = cntctfrm_handle_captcha_filters( 'remove_filters' ); if ( has_filter( 'cntctfrm_display_captcha' ) ) { $display_captcha_label = '' ; if ( array_key_exists ( 'captcha' , $cntctfrm_related_plugins ) && ( ( ! $contact_form_multi_active && ! empty ( $cntctfrm_related_plugins [ 'captcha' ][ 'options' ][ 'forms' ][ 'bws_contact' ][ 'enable' ] ) ) || ( $contact_form_multi_active && ! empty ( $cntctfrm_options [ 'display_captcha' ] ) ) ) ) { $display_captcha = true; } if ( array_key_exists ( 'google-captcha' , $cntctfrm_related_plugins ) && ( ( ! $contact_form_multi_active && ! empty ( $cntctfrm_related_plugins [ 'google-captcha' ][ 'options' ][ 'contact_form' ] ) ) || ( $contact_form_multi_active && ! empty ( $cntctfrm_options [ 'display_google_captcha' ] ) ) ) ) { $display_google_captcha = true; } if ( ! empty ( $display_captcha ) ) { if ( array_key_exists ( 'captcha' , $cntctfrm_related_plugins ) ) { $captcha_label = isset( $cntctfrm_related_plugins [ 'captcha' ][ 'options' ][ 'title' ] ) ? $cntctfrm_related_plugins [ 'captcha' ][ 'options' ][ 'title' ] : '' ; if ( ! empty ( $captcha_label ) ) { $captcha_required_symbol = sprintf( '<span class="required">%s</span>' , ( ! empty ( $cntctfrm_related_plugins [ 'captcha' ][ 'options' ][ 'required_symbol' ] ) ) ? $cntctfrm_related_plugins [ 'captcha' ][ 'options' ][ 'required_symbol' ] : '' ); $display_captcha_label = $captcha_label . $captcha_required_symbol ; } } } if ( ! empty ( $display_captcha ) || ! empty ( $display_google_captcha ) ) { $content .= '<div class="cntctfrm_field_wrap cntctfrm_field_captcha_wrap">' ; $content .= '<div class = "cntctfrm_label cntctfrm_label_captcha" > <label> ' . $display_captcha_label . ' </label> </div>'; if ( isset( $cntctfrm_error_message [ 'error_captcha' ] ) && $cntctfrm_form_count == $form_submited ) $content .= '<div class="cntctfrm_error_text">' . $cntctfrm_error_message [ 'error_captcha' ] . '</div>' ; $content .= '<div class="cntctfrm_input cntctfrm_input_captcha">' ; $content .= apply_filters( 'cntctfrm_display_captcha' , '' , 'bws_contact' ); $content .= '</div>' ; $content .= '</div>' ; } } cntctfrm_handle_captcha_filters( 'add_filters' , $removed_filters ); break ; default : break ; } } if ( has_filter( 'cntctfrm_foreach_custom_fields' ) ) $content = apply_filters( 'cntctfrm_foreach_custom_fields' , $custom_fields , $i , $form_submited , $form_countid , $lang , $content ); $content .= '</div>' ; } $content .= '<div class="clear"></div>' ; $cntctfrm_direction = is_rtl() ? 'rtl' : 'ltr' ; $submit_position_value = array ( 'ltr' => array ( 'left' => 1, 'right' => 2 ), 'rtl' => array ( 'left' => 2, 'right' => 1 ), ); $content .= '<div class="cntctfrm_submit_wrap">' ; for ( $i = 1; $i <= 2; $i ++ ) { $column = ( $i == 1 ) ? 'first_column' : 'second_column' ; $content .= '<div id="cntctfrm_submit_' . $column . '" class="cntctfrm_column">' ; if ( $i == $submit_position_value [ $cntctfrm_direction ][ $cntctfrm_options [ 'submit_position' ] ] ) { $content .= '<div class="cntctfrm_input cntctfrm_input_submit">' ; if ( isset( $atts [ 'id' ] ) ) $content .= '<input type="hidden" value="' . esc_attr( $atts [ 'id' ] ) . '" name="cntctfrmmlt_shortcode_id">' ; $content .= '<input type= "hidden" value= "send" name= "cntctfrm_contact_action" > <input type= "hidden" value= "' . esc_attr( $lang ) . '" name= "cntctfrm_language" > <input type= "hidden" value= "' . $cntctfrm_form_count . '" name= "cntctfrm_form_submited" > <input type= "hidden" value= "' . $options_name . '" name= "cntctfrm_options_name" > <input type= "submit" value= "' . $cntctfrm_options['submit_label'][ $lang ] . '" class = "cntctfrm_contact_submit" /> </div>'; } $content .= '</div>' ; } $content .= '<div class = "clear" ></div> </div> </form>'; } return $content ; } |
Code file location:
contact-form-plugin/contact-form-plugin/contact_form.php
Conclusion
Now that you’ve learned how to embed the Contact Form Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply