Ticket #27238: 27238.4.diff
File 27238.4.diff, 1.9 KB (added by , 10 years ago) |
---|
-
taxonomy.php
4112 4112 * 'before' : default is empty string. Display before taxonomies list. 4113 4113 * 'sep' : default is empty string. Separate every taxonomy with value in this. 4114 4114 * 'after' : default is empty string. Display this after the taxonomies list. 4115 * 'template' : The template to use for displaying the taxonomy terms. 4115 * 'template' : The template to use for displaying the taxonomy term list. 4116 * 'term_template' : The template to use for displaying the individual taxonomy terms. 4116 4117 * 4117 4118 * @since 2.5.0 4118 4119 * @uses get_the_taxonomies() … … 4126 4127 'sep' => ' ', 4127 4128 'after' => '', 4128 4129 /* translators: %s: taxonomy label, %l: list of term links */ 4129 'template' => __( '%s: %l.' ) 4130 'template' => '%s: %l.', 4131 'term_template' => '<a href="%1$s">%2$s</a>', 4130 4132 ); 4131 4133 4132 4134 $r = wp_parse_args( $args, $defaults ); … … 4152 4154 $args = wp_parse_args( $args, array( 4153 4155 /* translators: %s: taxonomy label, %l: list of term links */ 4154 4156 'template' => __( '%s: %l.' ), 4157 'term_template' => '<a href="%1$s">%2$s</a>', 4155 4158 ) ); 4156 4159 4157 4160 $taxonomies = array(); … … 4171 4174 if ( empty( $t['template'] ) ) { 4172 4175 $t['template'] = $args['template']; 4173 4176 } 4177 if ( empty( $t['term_template'] ) ) { 4178 $t['term_template'] = $args['term_template']; 4179 } 4174 4180 4181 4175 4182 $terms = get_object_term_cache( $post->ID, $taxonomy ); 4176 4183 if ( false === $terms ) { 4177 4184 $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); … … 4179 4186 $links = array(); 4180 4187 4181 4188 foreach ( $terms as $term ) { 4182 $links[] = "<a href='" . esc_attr( get_term_link( $term ) ) . "'>$term->name</a>";4189 $links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link($term) ), $term->name ); 4183 4190 } 4184 4191 if ( $links ) { 4185 4192 $taxonomies[$taxonomy] = wp_sprintf( $t['template'], $t['label'], $links, $terms );