Changeset 28415 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 05/15/2014 03:50:46 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r28241 r28415 3713 3713 * @return array 3714 3714 */ 3715 function get_the_taxonomies( $post = 0, $args = array() ) {3715 function get_the_taxonomies( $post = 0, $args = array() ) { 3716 3716 $post = get_post( $post ); 3717 3717 … … 3719 3719 'template' => '%s: %l.', 3720 3720 ) ); 3721 extract( $args, EXTR_SKIP );3722 3721 3723 3722 $taxonomies = array(); 3724 3723 3725 if ( ! $post )3724 if ( ! $post ) { 3726 3725 return $taxonomies; 3727 3728 foreach ( get_object_taxonomies($post) as $taxonomy ) { 3729 $t = (array) get_taxonomy($taxonomy); 3730 if ( empty($t['label']) ) 3726 } 3727 3728 foreach ( get_object_taxonomies( $post ) as $taxonomy ) { 3729 $t = (array) get_taxonomy( $taxonomy ); 3730 if ( empty( $t['label'] ) ) { 3731 3731 $t['label'] = $taxonomy; 3732 if ( empty($t['args']) ) 3732 } 3733 if ( empty( $t['args'] ) ) { 3733 3734 $t['args'] = array(); 3734 if ( empty($t['template']) ) 3735 $t['template'] = $template; 3736 3737 $terms = get_object_term_cache($post->ID, $taxonomy); 3738 if ( false === $terms ) 3739 $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); 3740 3735 } 3736 if ( empty( $t['template'] ) ) { 3737 $t['template'] = $args['template']; 3738 } 3739 3740 $terms = get_object_term_cache( $post->ID, $taxonomy ); 3741 if ( false === $terms ) { 3742 $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); 3743 } 3741 3744 $links = array(); 3742 3745 3743 foreach ( $terms as $term ) 3744 $links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>"; 3745 3746 if ( $links ) 3747 $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms); 3746 foreach ( $terms as $term ) { 3747 $links[] = "<a href='" . esc_attr( get_term_link( $term ) ) . "'>$term->name</a>"; 3748 } 3749 if ( $links ) { 3750 $taxonomies[$taxonomy] = wp_sprintf( $t['template'], $t['label'], $links, $terms ); 3751 } 3748 3752 } 3749 3753 return $taxonomies;
Note: See TracChangeset
for help on using the changeset viewer.