Viewing 1 replies (of 1 total)
  • There is a way, but you need to know how to code in PHP to do this.

    There are basically 2 ways to go about this, the first consist in replicating what the Listo extension does, which is hooking into the CF7 form processing of select/checkbox/radio options using the following filter, (see the example file contact-form-7/modules/listo.php)

    add_filter( 'wpcf7_form_tag_data_option', 'merge_list', 10, 3 );
    function merge_list( $data, $options, $args ) {
      //$options will have a list of options from the form shortcodes.
      $list = array('State1', 'State2');// list of states
      $data = array_merge( (array) $data, $list );
      return $data;
    }

    The 2nd option is to extend Listo itself, by implementing its interface for data items. Open one of the examples given in the listo plugin, file modules/countries.php for example, and create a similar file with your list of states. Then hook into the listo plugin using the filter 'listo_list_types',

    add_filter('listo_list_types', 'my-custom-listo');
    function my-custom-listo($lists_types){
      $lists_types['my-custom-list']='My_Custom_Listo_Interface_Class';
      //listo expects to find your class My_Custom_Listo_Interface_Class to use it
      require_once '<path to your listo interface extention hile.php>';
      return $lists_types;
    }
    • This reply was modified 8 years, 5 months ago by Aurovrata Venet. Reason: typo
Viewing 1 replies (of 1 total)
  • The topic ‘Adding custom states – Australia’ is closed to new replies.