rAthus

[WordPress] EventON custom fields hack in functions.php

Mar 7th, 2019
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. /** EventON custom fields **/
  2. add_filter('evocsv_additional_csv_fields', 'evocsv_function1', 10, 1);
  3. function evocsv_function1($array) {
  4.     $array['discipline'] = 'discipline';
  5.     $array['departement'] = 'departement';
  6.     $array['site_internet'] = 'site_internet';
  7.     $array['formation'] = 'formation';
  8.     return $array;
  9. }
  10. add_action('evocsv_save_event_custom_data', 'evocsv_function2', 10, 3);
  11. function evocsv_function2($eventID, $postdata, $field) {
  12.     if ($field=='discipline' and isset($postdata[$field])) {
  13.         add_post_meta($eventID, '_evcal_ec_f2a1_cus', $postdata[$field]);
  14.     }
  15.     elseif ($field=='departement' and isset($postdata[$field])) {
  16.         add_post_meta($eventID, '_evcal_ec_f1a1_cus', $postdata[$field]);
  17.     }
  18.     elseif ($field=='site_internet' and isset($postdata[$field])) {
  19.         add_post_meta($eventID, '_evcal_ec_f3a1_cus', $postdata[$field]);
  20.     }
  21.     elseif ($field=='formation' and isset($postdata[$field])) {
  22.         add_post_meta($eventID, '_evcal_ec_f4a1_cus', $postdata[$field]);
  23.     }
  24. }
Add Comment
Please, Sign In to add comment