Created
May 9, 2013 08:09
-
-
Save geilt/5546181 to your computer and use it in GitHub Desktop.
get_term_meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!function_exists('get_term_meta')): | |
function get_term_meta($term, $taxonomy, $key, $single = false ){ | |
if(!$taxonomy && !$term): | |
return false; | |
endif; | |
if(!is_numeric($term)): | |
$term = get_term_by('slug', $term, $taxonomy); | |
$term = $term->term_id; | |
endif; | |
$term = get_option('taxonomy_' . $term); | |
if($key): | |
if(!empty($term[$key])) return $term[$key]; else return ''; | |
endif; | |
return $term; | |
} | |
endif; | |
if(!function_exists('the_term_meta')): | |
function the_term_meta($term, $taxonomy, $key, $single = false ){ | |
if(!$term && !$taxonomy && !$value): | |
return false; | |
endif; | |
echo get_term_meta($term, $taxonomy, $key, true); | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment