function gdlr_save_post_meta_option($post_id) { if (get_post_type() == 'post' && isset($_POST['post-option'])) { $post_option = gdlr_preventslashes(gdlr_stripslashes($_POST['post-option'])); $post_option = json_decode(gdlr_decode_preventslashes($post_option), true); if (!empty($post_option['rating'])) { update_post_meta($post_id, 'gdlr-post-rating', floatval($post_option['rating']) * 100); } else { delete_post_meta($post_id, 'gdlr-post-rating'); } } }
function save_page_option($post_id) { if (empty($_POST[$this->setting['option_name']]) || empty($post_id)) { return; } if (!in_array(get_post_type($post_id), $this->setting['post_type'])) { return; } if (isset($_POST[$this->setting['option_name']])) { update_post_meta($post_id, $this->setting['option_name'], gdlr_preventslashes($_POST[$this->setting['option_name']])); } $post_option = gdlr_preventslashes(gdlr_stripslashes($_POST['post-option'])); $post_option = json_decode(gdlr_decode_preventslashes($post_option), true); // for custom_field attribute foreach ($this->option as $option_section) { foreach ($option_section['options'] as $option_slug => $option) { if (!empty($option['custom_field'])) { if ($option['type'] == 'multi-combobox') { update_post_meta($post_id, $option['custom_field'], json_encode($post_option[$option_slug])); } else { update_post_meta($post_id, $option['custom_field'], $post_option[$option_slug]); } } } } // for custom meta filter $custom_meta = apply_filters('gdlr_custom_page_option_meta', array(), $post_option); if (!empty($custom_meta)) { foreach ($custom_meta as $meta) { if (!empty($meta['key']) && !empty($meta['value'])) { update_post_meta($post_id, $meta['key'], $meta['value']); } } } }
function save_page_option($post_id) { if (empty($_POST[$this->setting['option_name']]) || empty($post_id)) { return; } if (isset($_POST[$this->setting['option_name']])) { update_post_meta($post_id, $this->setting['option_name'], gdlr_preventslashes($_POST[$this->setting['option_name']])); } $post_option = gdlr_preventslashes(gdlr_stripslashes($_POST['post-option'])); $post_option = json_decode(gdlr_decode_preventslashes($post_option), true); $custom_meta = apply_filters('gdlr_custom_page_option_meta', array(), $post_option); if (!empty($custom_meta)) { foreach ($custom_meta as $meta) { if (!empty($meta['key']) && !empty($meta['value'])) { update_post_meta($post_id, $meta['key'], $meta['value']); } } } }
function save_page_builder($post_id) { foreach ($this->setting['section'] as $section_slug => $section) { if (isset($_POST[$section_slug])) { update_post_meta($post_id, $section_slug, gdlr_preventslashes($_POST[$section_slug])); } } }
function save_page_option($post_id) { if (isset($_POST[$this->setting['option_name']])) { update_post_meta($post_id, $this->setting['option_name'], gdlr_preventslashes($_POST[$this->setting['option_name']])); } }
function gdlr_save_cause_meta_option($post_id) { if (get_post_type() == 'cause' && isset($_POST['post-option'])) { $post_option = gdlr_preventslashes(gdlr_stripslashes($_POST['post-option'])); $event_option = json_decode(gdlr_decode_preventslashes($post_option), true); if (!empty($event_option['current-funding'])) { update_post_meta($post_id, 'gdlr-current-funding', $event_option['current-funding']); } if (!empty($event_option['goal-of-donation'])) { $goal = floatval($event_option['goal-of-donation']); $current = floatval($event_option['current-funding']); $percent = intval($current / $goal * 100); update_post_meta($post_id, 'gdlr-donation-percent', $percent); } } }