WordPress.org

Make WordPress Core

Ticket #27238: 27238.4.diff

File 27238.4.diff, 1.9 KB (added by hereswhatidid, 6 years ago)

Fixed replace string name to be more consistent.

  • taxonomy.php

     
    41124112 * 'before' : default is empty string. Display before taxonomies list.
    41134113 * 'sep' : default is empty string. Separate every taxonomy with value in this.
    41144114 * '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.
    41164117 *
    41174118 * @since 2.5.0
    41184119 * @uses get_the_taxonomies()
     
    41264127                'sep' => ' ',
    41274128                'after' => '',
    41284129                /* 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>',
    41304132        );
    41314133
    41324134        $r = wp_parse_args( $args, $defaults );
     
    41524154        $args = wp_parse_args( $args, array(
    41534155                /* translators: %s: taxonomy label, %l: list of term links */
    41544156                'template' => __( '%s: %l.' ),
     4157                'term_template' => '<a href="%1$s">%2$s</a>',
    41554158        ) );
    41564159
    41574160        $taxonomies = array();
     
    41714174                if ( empty( $t['template'] ) ) {
    41724175                        $t['template'] = $args['template'];
    41734176                }
     4177                if ( empty( $t['term_template'] ) ) {
     4178                        $t['term_template'] = $args['term_template'];
     4179                }
    41744180
     4181
    41754182                $terms = get_object_term_cache( $post->ID, $taxonomy );
    41764183                if ( false === $terms ) {
    41774184                        $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] );
     
    41794186                $links = array();
    41804187
    41814188                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 );
    41834190                }
    41844191                if ( $links ) {
    41854192                        $taxonomies[$taxonomy] = wp_sprintf( $t['template'], $t['label'], $links, $terms );