WordPress.org

Make WordPress Core

Ticket #27238: 27238.3.diff

File 27238.3.diff, 1.8 KB (added by hereswhatidid, 7 years ago)

Made the term_template default value more in line with what the documentation would support.

  • src/wp-includes/taxonomy.php

     
    31733173 * 'before' : default is empty string. Display before taxonomies list.
    31743174 * 'sep' : default is empty string. Separate every taxonomy with value in this.
    31753175 * 'after' : default is empty string. Display this after the taxonomies list.
    3176  * 'template' : The template to use for displaying the taxonomy terms.
     3176 * 'template' : The template to use for displaying the taxonomy term list.
     3177 * 'term_template' : The template to use for displaying the individual taxonomy terms.
    31773178 *
    31783179 * @since 2.5.0
    31793180 * @uses get_the_taxonomies()
     
    31863187                'before' => '',
    31873188                'sep' => ' ',
    31883189                'after' => '',
    3189                 'template' => '%s: %l.'
     3190                'template' => '%s: %l.',
     3191                'term_template' => '<a href="%s$s">%2$s</a>',
    31903192        );
    31913193
    31923194        $r = wp_parse_args( $args, $defaults );
     
    32123214
    32133215        $args = wp_parse_args( $args, array(
    32143216                'template' => '%s: %l.',
     3217                'term_template' => '<a href="%s$s">%2$s</a>',
    32153218        ) );
    32163219        extract( $args, EXTR_SKIP );
    32173220
     
    32283231                        $t['args'] = array();
    32293232                if ( empty($t['template']) )
    32303233                        $t['template'] = $template;
     3234                if ( empty($t['term_template']) )
     3235                        $t['term_template'] = $term_template;
    32313236
    32323237                $terms = get_object_term_cache($post->ID, $taxonomy);
    32333238                if ( false === $terms )
     
    32363241                $links = array();
    32373242
    32383243                foreach ( $terms as $term )
    3239                         $links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";
     3244                        $links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link($term) ), $term->name );
    32403245
    32413246                if ( $links )
    32423247                        $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);