WordPress.org

Make WordPress Core

Changeset 41756


Ignore:
Timestamp:
10/04/2017 11:52:03 PM (3 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.

Location:
trunk/src/wp-content/themes
Files:
20 edited

Legend:

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

    r37040 r41756  
    744744    return $images;
    745745}
     746
     747/**
     748 * Modifies tag cloud widget arguments to display all tags in the same font size
     749 * and use list format for better accessibility.
     750 *
     751 * @since Twenty Eleven 2.7
     752 *
     753 * @param array $args Arguments for tag cloud widget.
     754 * @return array The filtered arguments for tag cloud widget.
     755 */
     756function twentyeleven_widget_tag_cloud_args( $args ) {
     757    $args['largest']  = 22;
     758    $args['smallest'] = 8;
     759    $args['unit']     = 'pt';
     760    $args['format']   = 'list';
     761
     762    return $args;
     763}
     764add_filter( 'widget_tag_cloud_args', 'twentyeleven_widget_tag_cloud_args' );
  • trunk/src/wp-content/themes/twentyeleven/style.css

    r40883 r41756  
    19231923
    19241924/* Calendar Widget */
    1925 
    19261925.widget_calendar #wp-calendar {
    19271926    color: #555;
     
    19531952
    19541953/* Text Widget */
    1955 
    19561954.widget_text ul,
    19571955.widget_text ol {
     
    19631961.widget_text ol ul {
    19641962    margin-bottom: 0;
     1963}
     1964
     1965/* Tag Cloud Widget */
     1966.tagcloud ul {
     1967    list-style-type: none;
     1968}
     1969
     1970.tagcloud ul li {
     1971    display: inline-block;
    19651972}
    19661973
     
    23332340}
    23342341
    2335 
    23362342/* =Responsive Structure
    23372343----------------------------------------------- */
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

    r38870 r41756  
    387387
    388388/**
     389 * Modifies tag cloud widget arguments to display all tags in the same font size
     390 * and use list format for better accessibility.
     391 *
     392 * @since Twenty Fifteen 1.9
     393 *
     394 * @param array $args Arguments for tag cloud widget.
     395 * @return array The filtered arguments for tag cloud widget.
     396 */
     397function twentyfifteen_widget_tag_cloud_args( $args ) {
     398    $args['largest']  = 22;
     399    $args['smallest'] = 8;
     400    $args['unit']     = 'pt';
     401    $args['format']   = 'list';
     402
     403    return $args;
     404}
     405add_filter( 'widget_tag_cloud_args', 'twentyfifteen_widget_tag_cloud_args' );
     406
     407
     408/**
    389409 * Implement the Custom Header feature.
    390410 *
  • trunk/src/wp-content/themes/twentyfifteen/inc/template-tags.php

    r40023 r41756  
    9898
    9999        $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
    100         if ( $tags_list ) {
     100        if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    101101            printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    102102                _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ),
  • trunk/src/wp-content/themes/twentyfifteen/style.css

    r40883 r41756  
    15601560}
    15611561
     1562.tagcloud ul {
     1563    list-style-type: none;
     1564}
     1565
     1566.tagcloud ul li {
     1567    display: inline-block;
     1568}
    15621569
    15631570/**
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r40022 r41756  
    528528add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
    529529
     530
     531/**
     532 * Modifies tag cloud widget arguments to display all tags in the same font size
     533 * and use list format for better accessibility.
     534 *
     535 * @since Twenty Fourteen 2.1
     536 *
     537 * @param array $args Arguments for tag cloud widget.
     538 * @return array The filtered arguments for tag cloud widget.
     539 */
     540function twentyfourteen_widget_tag_cloud_args( $args ) {
     541    $args['largest']  = 22;
     542    $args['smallest'] = 8;
     543    $args['unit']     = 'pt';
     544    $args['format']   = 'list';
     545
     546    return $args;
     547}
     548add_filter( 'widget_tag_cloud_args', 'twentyfourteen_widget_tag_cloud_args' );
     549
     550
    530551// Implement Custom Header features.
    531552require get_template_directory() . '/inc/custom-header.php';
  • trunk/src/wp-content/themes/twentyfourteen/style.css

    r40883 r41756  
    25842584}
    25852585
     2586.tagcloud ul {
     2587    list-style-type: none;
     2588}
     2589
     2590.tagcloud ul li {
     2591    display: inline-block;
     2592}
     2593
    25862594/* Recent Posts Widget */
    25872595
  • trunk/src/wp-content/themes/twentyseventeen/functions.php

    r41703 r41756  
    543543
    544544/**
    545  * Modify tag cloud widget arguments to display all tags in the same font size
     545 * Modifies tag cloud widget arguments to display all tags in the same font size
    546546 * and use list format for better accessibility.
    547547 *
     
    556556    $args['unit']     = 'em';
    557557    $args['format']   = 'list';
     558
    558559    return $args;
    559560}
  • trunk/src/wp-content/themes/twentyseventeen/inc/template-tags.php

    r40795 r41756  
    8585                        }
    8686
    87                         if ( $tags_list ) {
     87                        if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    8888                            echo '<span class="tags-links">' . twentyseventeen_get_svg( array( 'icon' => 'hashtag' ) ) . '<span class="screen-reader-text">' . __( 'Tags', 'twentyseventeen' ) . '</span>' . $tags_list . '</span>';
    8989                        }
  • trunk/src/wp-content/themes/twentysixteen/functions.php

    r41580 r41756  
    416416
    417417/**
    418  * Modifies tag cloud widget arguments to have all tags in the widget same font size.
     418 * Modifies tag cloud widget arguments to display all tags in the same font size
     419 * and use list format for better accessibility.
    419420 *
    420421 * @since Twenty Sixteen 1.1
    421422 *
    422423 * @param array $args Arguments for tag cloud widget.
    423  * @return array A new modified arguments.
     424 * @return array The filtered arguments for tag cloud widget.
    424425 */
    425426function twentysixteen_widget_tag_cloud_args( $args ) {
    426     $args['largest'] = 1;
     427    $args['largest']  = 1;
    427428    $args['smallest'] = 1;
    428     $args['unit'] = 'em';
     429    $args['unit']     = 'em';
     430    $args['format']   = 'list';
     431
    429432    return $args;
    430433}
  • trunk/src/wp-content/themes/twentysixteen/inc/template-tags.php

    r40908 r41756  
    102102
    103103    $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
    104     if ( $tags_list ) {
     104    if ( $tags_list && ! is_wp_error( $tags_list ) ) {
    105105        printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    106106            _x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
  • trunk/src/wp-content/themes/twentysixteen/rtl.css

    r40851 r41756  
    316316}
    317317
     318.tagcloud ul {
     319    margin-right: 0;
     320}
     321
    318322
    319323/**
  • trunk/src/wp-content/themes/twentysixteen/style.css

    r40851 r41756  
    15151515}
    15161516
     1517.tagcloud ul {
     1518    list-style-type: none;
     1519    margin-left: 0;
     1520}
     1521
     1522.tagcloud ul li {
     1523    display: inline-block;
     1524}
     1525
    15171526.tagcloud a:hover,
    15181527.tagcloud a:focus {
  • 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' );
  • trunk/src/wp-content/themes/twentyten/rtl.css

    r40839 r41756  
    271271}
    272272
     273#main .widget-area .tagcloud ul,
     274.widget-area .tagcloud ul {
     275    margin-right: 0;
     276}
     277
    273278/* =Footer
    274279-------------------------------------------------------------- */
  • trunk/src/wp-content/themes/twentyten/style.css

    r40883 r41756  
    12391239    max-width: 100%;
    12401240}
     1241.tagcloud ul {
     1242    list-style-type: none;
     1243    margin-left: 0 !important;
     1244}
     1245.tagcloud ul li {
     1246    display: inline-block;
     1247}
    12411248
    12421249/* Main sidebars */
  • trunk/src/wp-content/themes/twentythirteen/functions.php

    r38870 r41756  
    616616}
    617617add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );
     618
     619/**
     620 * Modifies tag cloud widget arguments to display all tags in the same font size
     621 * and use list format for better accessibility.
     622 *
     623 * @since Twenty Thirteen 2.3
     624 *
     625 * @param array $args Arguments for tag cloud widget.
     626 * @return array The filtered arguments for tag cloud widget.
     627 */
     628function twentythirteen_widget_tag_cloud_args( $args ) {
     629    $args['largest']  = 22;
     630    $args['smallest'] = 8;
     631    $args['unit']     = 'pt';
     632    $args['format']   = 'list';
     633
     634    return $args;
     635}
     636add_filter( 'widget_tag_cloud_args', 'twentythirteen_widget_tag_cloud_args' );
  • trunk/src/wp-content/themes/twentythirteen/style.css

    r40883 r41756  
    25632563
    25642564/* Text widget */
    2565 
    25662565.widget_text ul,
    25672566.widget_text ol {
     
    25852584.widget_text ol {
    25862585    list-style: decimal;
     2586}
     2587
     2588/* Tag Cloud widget */
     2589.tagcloud ul {
     2590    list-style-type: none;
     2591}
     2592
     2593.tagcloud ul li {
     2594    display: inline-block;
     2595    padding: 0;
    25872596}
    25882597
  • trunk/src/wp-content/themes/twentytwelve/functions.php

    r38870 r41756  
    560560}
    561561add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
     562
     563
     564/**
     565 * Modifies tag cloud widget arguments to display all tags in the same font size
     566 * and use list format for better accessibility.
     567 *
     568 * @since Twenty Twelve 2.4
     569 *
     570 * @param array $args Arguments for tag cloud widget.
     571 * @return array The filtered arguments for tag cloud widget.
     572 */
     573function twentytwelve_widget_tag_cloud_args( $args ) {
     574    $args['largest']  = 22;
     575    $args['smallest'] = 8;
     576    $args['unit']     = 'pt';
     577    $args['format']   = 'list';
     578
     579    return $args;
     580}
     581add_filter( 'widget_tag_cloud_args', 'twentytwelve_widget_tag_cloud_args' );
  • trunk/src/wp-content/themes/twentytwelve/style.css

    r40883 r41756  
    14511451    text-align: right;
    14521452}
     1453.tagcloud ul {
     1454    list-style-type: none;
     1455}
     1456
     1457.tagcloud ul li {
     1458    display: inline-block;
     1459}
     1460
     1461.widget-area .widget.widget_tag_cloud li {
     1462    line-height: 1;
     1463}
     1464.template-front-page .widget-area .widget.widget_tag_cloud li {
     1465    margin: 0;
     1466}
    14531467
    14541468/* =Plugins
     
    14601474    margin: 0 auto 1.714285714rem;
    14611475}
    1462 
    14631476
    14641477/* =Media queries
Note: See TracChangeset for help on using the changeset viewer.