Other Documentations
Import additional fields using hooks
September 26, 2019
In order to add support for additional fields to use in the CSV file for importing additional data into eventON, you can use the code below. NOTE: It is best to include the below code in your theme’s function.php
1 2 3 4 5 6 7 |
add_filter('evocsv_additional_csv_fields', 'evocsv_function1', 10, 1); function evocsv_function1($array){ $array['newfield'] = 'newfield'; return $array; } |
Action to perform to import the new data from CSV file into event
1 2 3 4 5 6 7 8 9 10 11 |
add_action('evocsv_save_event_custom_data','evocsv_function2', 10, 3); function evocsv_function2($eventID, $postdata, $field){ if($field == 'newfield' && isset( $postdata[$field]) ){ add_post_meta($eventID, '_field_var_name', $postdata[$field]); } } |
In the CSV file create a new column to match the field name eg. newfield – according to above example. And type in the values you want to pass.
The new field column would look like the above image when CSV file opended in Microsoft Excel. The CSV file column name must match the field name set in the above example. (newfield)
Required CSV importer version 1.0 and up
Did this article help you? If not, send us a ticket via helpdesk