• Resolved pierremichaux

    (@pierremichaux)


    Hi,
    I have a website in french and I would like to change the text of the address like Address Line 1, State/Province/Region
    Can I do that?
    Thank you,
    Pierre

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Ethan Choi

    (@ethanchoi)

    Hi pierremichaux,

    We don’t have a built-in way to change the Address field sublabels. However, you can do this with some custom code:

    /**
    *
    * Change Address field sublabels for the 'International' address scheme
    *
    */
    
    function wpf_dev_address_field_properties( $properties, $field, $form_data ) {
      
      // check for address scheme
      if ( $field['scheme'] === 'international' ){
    	  // Change sublabel values
    	  $properties['inputs']['address1']['sublabel']['value'] = 'Address Line 1';
    	  $properties['inputs']['address2']['sublabel']['value'] = 'Address Line 2';
    	  $properties['inputs']['city']['sublabel']['value'] = 'City';
    	  $properties['inputs']['state']['sublabel']['value'] = 'State / Province / Region';
    	  $properties['inputs']['postal']['sublabel']['value'] = 'Postal Code';
    	  $properties['inputs']['country']['sublabel']['value'] = 'Country';
      	}
        return $properties;
    }
    
    add_filter( 'wpforms_field_properties_address' , 'wpf_dev_address_field_properties', 10, 3 );
    

    In case it helps, here’s our tutorial with the most common ways to add custom code like this.

    For the most beginner-friendly option in that tutorial, I’d recommend using the Code Snippets plugin.

    I hope this helps! As a user of the paid version of WPForms, if you have further questions about paid features of WPForms, please contact us by submitting a support ticket. This is because WordPress.org rules do not allow support for paid features of WPForms on the support forum for WPForms Lite.

    Thanks 🙂

    • This reply was modified 6 years, 11 months ago by Ethan Choi.
Viewing 1 replies (of 1 total)

The topic ‘Address field’ is closed to new replies.