Make WordPress Core


Ignore:
Timestamp:
10/04/2017 11:52:03 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Bundled Themes: Change tag cloud format to a list (<ul>) for better semantics and accessibility.

List markup allows screen reader users to know in advance how many tags are within the list.

Props xkon, davidakennedy.
Fixes #40138.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyten/functions.php

    r32116 r41756  
    537537    // Retrieves tag list of current post, separated by commas.
    538538    $tag_list = get_the_tag_list( '', ', ' );
    539     if ( $tag_list ) {
     539    if ( $tag_list && ! is_wp_error( $tag_list ) ) {
    540540        $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
    541541    } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
     
    594594    return $images;
    595595}
     596
     597/**
     598 * Modifies tag cloud widget arguments to display all tags in the same font size
     599 * and use list format for better accessibility.
     600 *
     601 * @since Twenty Ten 2.4
     602 *
     603 * @param array $args Arguments for tag cloud widget.
     604 * @return array The filtered arguments for tag cloud widget.
     605 */
     606function twentyten_widget_tag_cloud_args( $args ) {
     607    $args['largest']  = 22;
     608    $args['smallest'] = 8;
     609    $args['unit']     = 'pt';
     610    $args['format']   = 'list';
     611
     612    return $args;
     613}
     614add_filter( 'widget_tag_cloud_args', 'twentyten_widget_tag_cloud_args' );
Note: See TracChangeset for help on using the changeset viewer.