|
@@ 2014-2033 (lines=20) @@
|
| 2011 |
|
|
| 2012 |
|
|
| 2013 |
|
//get term meta field |
| 2014 |
|
public function get_tax_meta($term_id, $key, $multi = false, $post_type = '') |
| 2015 |
|
{ |
| 2016 |
|
|
| 2017 |
|
if (empty($post_type) && isset($_REQUEST['taxonomy'])) { |
| 2018 |
|
$taxObject = get_taxonomy($_REQUEST['taxonomy']); |
| 2019 |
|
$post_type = $taxObject->object_type[0]; |
| 2020 |
|
} |
| 2021 |
|
|
| 2022 |
|
if($post_type=='post'){$post_type='';} |
| 2023 |
|
if($post_type){$post_type = $post_type.'_';} |
| 2024 |
|
|
| 2025 |
|
$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id; |
| 2026 |
|
|
| 2027 |
|
$m = get_option('tax_meta_' . $post_type . $t_id); |
| 2028 |
|
if (isset($m[$key])) { |
| 2029 |
|
return $m[$key]; |
| 2030 |
|
} else { |
| 2031 |
|
return ''; |
| 2032 |
|
} |
| 2033 |
|
} |
| 2034 |
|
|
| 2035 |
|
//delete meta |
| 2036 |
|
public function delete_tax_meta($term_id, $key, $post_type = '') |
|
@@ 2097-2116 (lines=20) @@
|
| 2094 |
|
|
| 2095 |
|
//get term meta field |
| 2096 |
|
if (!function_exists('get_tax_meta')) { |
| 2097 |
|
function get_tax_meta($term_id, $key, $multi = false, $post_type = '') |
| 2098 |
|
{ |
| 2099 |
|
|
| 2100 |
|
if (empty($post_type) && isset($_REQUEST['taxonomy'])) { |
| 2101 |
|
$taxObject = get_taxonomy($_REQUEST['taxonomy']); |
| 2102 |
|
$post_type = $taxObject->object_type[0]; |
| 2103 |
|
} |
| 2104 |
|
|
| 2105 |
|
if($post_type=='post'){$post_type='';} |
| 2106 |
|
if($post_type){$post_type = $post_type.'_';} |
| 2107 |
|
|
| 2108 |
|
$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id; |
| 2109 |
|
|
| 2110 |
|
$m = get_option('tax_meta_' . $post_type . $t_id); |
| 2111 |
|
if (isset($m[$key])) { |
| 2112 |
|
return $m[$key]; |
| 2113 |
|
} else { |
| 2114 |
|
return ''; |
| 2115 |
|
} |
| 2116 |
|
} |
| 2117 |
|
} |
| 2118 |
|
|
| 2119 |
|
//delete meta |