get_the_taxonomies [ WordPress Function ]
get_the_taxonomies ( $post = 0, $args = array() )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: get_taxonomies, the_taxonomies, get_post_taxonomies, get_attachment_taxonomies, get_object_taxonomies
Retrieve all taxonomies associated with a post.
This function can be used within the loop. It will also return an array of the taxonomies with links to the taxonomy and name.
Source
<?php
function get_the_taxonomies($post = 0, $args = array() ) {
if ( is_int($post) )
$post =& get_post($post);
elseif ( !is_object($post) )
$post =& $GLOBALS['post'];
$args = wp_parse_args( $args, array(
'template' => '%s: %l.',
) );
extract( $args, EXTR_SKIP );
$taxonomies = array();
if ( !$post )
return $taxonomies;
foreach ( get_object_taxonomies($post) as $taxonomy ) {
$t = (array) get_taxonomy($taxonomy);
if ( empty($t['label']) )
$t['label'] = $taxonomy;
if ( empty($t['args']) )
$t['args'] = array();
if ( empty($t['template']) )
$t['template'] = $template;
$terms = get_object_term_cache($post->ID, $taxonomy);
if ( empty($terms) )
$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
$links = array();
foreach ( $terms as $term )
$links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";
if ( $links )
$taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
}
return $taxonomies;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- outputting posts' taxonomies: cant get 'get_the_taxonomies' working ...
Feb 23, 2011 ... I want to output the taxonomies associated with a post in a 'title' attribute, so it needs to be unformatted. I know about get_terms and ...
wordpress.stackexchange.com - get_the_taxonomies (WordPress Function) - WPSeek.com
WordPress lookup for get_the_taxonomies, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - WordPress › Support » Tags — get_the_taxonomies
Forums. Username or Email Address Password (forgot?) Register · WordPress › Support » get_the_taxonomies. Tag: get_the_taxonomies Add New » ...
wordpress.org - get_the_taxonomies | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_the_taxonomies($post = 0, $args = array() {}. Retrieve all taxonomies associated with a post. This function can be used within the ...
hitchhackerguide.com