function get_term_custom_values($key = '', $term_id) { if (!$key) { return null; } $custom = get_term_custom($term_id); return isset($custom[$key]) ? $custom[$key] : null; }
function get_all_fieldtaxo($term_id = null, $taxonomy = null) { global $custom_fields; if ($term_id == null || $taxonomy == null) { return false; } $term = get_term($term_id, $taxonomy); if (is_wp_error($term)) { return false; } $ar = get_term_custom($taxonomy, $term_id); if (is_wp_error($ar) || $ar == false) { return false; } $metas = array(); $cf_pt =& $custom_fields['admin-base']->taxo_nav[$taxonomy]; foreach ($ar as $key => $value) { $key = explode('__', $key); if (count($key) <= 1) { continue; } $value = current($value); $value = maybe_unserialize($value); if (isset($cf_pt->option_fields[$key[0]][$key[1]]['title'])) { $metas[strtolower($cf_pt->option_fields[$key[0]][$key[1]]['title'])] = $value; } } return $metas; }