Changeset 30209 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 11/03/2014 06:48:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r30205 r30209 4132 4132 * display the taxonomies for a specific post. 4133 4133 * 4134 * The available defaults are:4135 * 'post' : default is 0. The post ID to get taxonomies of.4136 * 'before' : default is empty string. Display before taxonomies list.4137 * 'sep' : default is empty string. Separate every taxonomy with value in this.4138 * 'after' : default is empty string. Display this after the taxonomies list.4139 * 'template' : The template to use for displaying the taxonomy terms.4140 *4141 4134 * @since 2.5.0 4142 4135 * 4143 * @param array $args Override the defaults. 4136 * @param array $args { 4137 * Arguments about which post to use and how to format the output. 4138 * 4139 * @type int|WP_Post $post Post ID or object to get taxonomies of. Default current post. 4140 * @type string $before Displays before the taxonomies. Default empty string. 4141 * @type string $sep Separates each taxonomy. Default is a space. 4142 * @type string $after Displays after the taxonomies. Default empty string. 4143 * @type string $template Template for displaying a taxonomy label and list of 4144 * terms. Default is "Label: Terms." 4145 * @type string $term_template Template for displaying a single term in the list. 4146 * Default is the term name linked to its archive. 4147 * } 4144 4148 */ 4145 4149 function the_taxonomies( $args = array() ) { … … 4149 4153 'sep' => ' ', 4150 4154 'after' => '', 4151 /* translators: %s: taxonomy label, %l: list of term links */ 4152 'template' => __( '%s: %l.' ) 4155 /* translators: %s: taxonomy label, %l: list of terms formatted as per $term_template */ 4156 'template' => __( '%s: %l.' ), 4157 /* translators: %1$s: term link, %2$s: term name */ 4158 'term_template' => '<a href="%1$s">%2$s</a>', 4153 4159 ); 4154 4160 … … 4174 4180 4175 4181 $args = wp_parse_args( $args, array( 4176 /* translators: %s: taxonomy label, %l: list of term links*/4182 /* translators: %s: taxonomy label, %l: list of terms formatted as per $term_template */ 4177 4183 'template' => __( '%s: %l.' ), 4184 /* translators: %1$s: term link, %2$s: term name */ 4185 'term_template' => '<a href="%1$s">%2$s</a>', 4178 4186 ) ); 4179 4187 … … 4195 4203 $t['template'] = $args['template']; 4196 4204 } 4205 if ( empty( $t['term_template'] ) ) { 4206 $t['term_template'] = $args['term_template']; 4207 } 4197 4208 4198 4209 $terms = get_object_term_cache( $post->ID, $taxonomy ); … … 4203 4214 4204 4215 foreach ( $terms as $term ) { 4205 $links[] = "<a href='" . esc_attr( get_term_link( $term ) ) . "'>$term->name</a>";4216 $links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link( $term ) ), $term->name ); 4206 4217 } 4207 4218 if ( $links ) {
Note: See TracChangeset
for help on using the changeset viewer.