Category: Admin
Setting the Default Address Scheme to International
/* * Change the scheme for the address field * * @link https://wpforms.com/developers/how-to-set-the-address-default-scheme-to-international */ function wpf_dev_field_new_default( $field ) { // default scheme set to international if ($field[ ‘type’ ] === ‘address’) { $field[ ‘format’ ] = ‘international’; $field[ ‘scheme_selected’ ]…Continue reading
Adding Material Design to Your Form Fields Using CSS
#wpforms-form-697 { float: left; width: 100%; text-align: center; margin: 30px auto 30px auto; } #wpforms-form-697 .wpforms-field { margin-left: auto; margin-right: auto; max-width: 300px; margin-bottom: 15px; position: relative; } #wpforms-form-697 .wpforms-field input, #wpforms-form-697 .wpforms-field textarea { position: relative; display: block; width:…Continue reading
How to Add Material Design to Your Form Fields Using CSS
/** * Move label position from above form field to below * * @link https://wpforms.com/developers/how-to-add-material-design-to-your-form-fields-using-css/ */ function wpf_dev_display_field_before( $field, $form_data ) { // Only run this snippet on form ID 697 if ( absint( $form_data[ ‘id’ ] ) !== 697…Continue reading
Creating a Form With Floating Labels
form#wpforms-form-1682 { position: relative; } form#wpforms-form-1682 .floating label:nth-of-type(2) { display: none; } .floating input { position: relative; min-height: 65px; padding: 15px 10px 10px 15px !important; } .floating textarea { position: relative; min-height: 200px; padding: 35px 15px 15px 15px !important; }…Continue reading
Overwriting Entries From Users Who Have Already Submitted a Form
/* * Remove all user entries before saving the entry – this is for all forms. * * @link https://wpforms.com/developers/how-to-overwrite-entries-from-users-who-have-already-submitted-a-form/ */ function remove_all_before_entry_save( $fields, $entry, $form_id ) { //get the current user’s user ID $user_id = get_current_user_id(); //check if the…Continue reading
How to Create a Form With Floating Labels
/** * Remove the field label from the top of the field * * @link https://wpforms.com/developers/how-to-create-a-form-with-floating-labels/ */ function wpf_dev_display_field_before( $field, $form_data ) { // Only run this snippet on the form ID 1289 if ( absint( $form_data[ ‘id’ ] )…Continue reading
Displaying Shortcodes Inside Form Label Fields
/** * Run shortcodes on the form label field. * * @link https://wpforms.com/developers/how-to-display-shortcodes-inside-the-label-of-the-form-field/ */ function add_shortcode_to_label( $field, $form_data ) { // Check that the form ID is 1055 and the field id is 4 if ( 1055 === absint( $form_data[…Continue reading
Creating a Smart Tag from an ACF Field
/** * Register the Smart Tag so it will be available to select in the form builder. * * @link https://wpforms.com/developers/how-to-create-a-smart-tag-from-an-acf-field/ */ function wpf_dev_register_smarttag( $tags ) { // Key is the tag, item is the tag name. $tags[ ‘portfolio_price’ ]…Continue reading
Adding Custom Border to Your Form
/* Add custom border to specific form */ #wpforms-form-1234 { border: 2px solid #333333; padding: 20px; border-radius: 5px; background-color: #ffffff; box-shadow: 0 0 10px rgba(0,0,0,0.1); }Continue reading