WordPress.org

Make WordPress Core

Ticket #30705: category-template.diff

File category-template.diff, 1.2 KB (added by davidjlaietta, 6 years ago)

inclusion of $term_template argument

  • category-template.php

     
    12781278 * @param string $before Optional. Before list.
    12791279 * @param string $sep Optional. Separate items using this.
    12801280 * @param string $after Optional. After list.
     1281 * @param string $term_template Optional. Template for displaying a single term in the list. Default is the term name linked to its archive
    12811282 * @return string|bool|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
    12821283 */
    1283 function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
     1284function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '', $term_template = '<a href="%1$s">%2$s</a>' ) {
    12841285        $terms = get_the_terms( $id, $taxonomy );
    12851286
    12861287        if ( is_wp_error( $terms ) )
     
    12931294                $link = get_term_link( $term, $taxonomy );
    12941295                if ( is_wp_error( $link ) )
    12951296                        return $link;
    1296                 $term_links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
     1297                $term_links[] = wp_sprintf( $term_template, esc_attr( get_term_link($term) ), $term->name );
    12971298        }
    12981299
    12991300        /**