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.
Built from https://develop.svn.wordpress.org/trunk@41756


git-svn-id: http://core.svn.wordpress.org/trunk@41590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2017-10-04 23:53:47 +00:00
parent 1ad81b4909
commit 03ef2f7d05
2 changed files with 34 additions and 1 deletions

View File

@ -559,3 +559,23 @@ function twentytwelve_customize_preview_js() {
wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true );
}
add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
/**
* Modifies tag cloud widget arguments to display all tags in the same font size
* and use list format for better accessibility.
*
* @since Twenty Twelve 2.4
*
* @param array $args Arguments for tag cloud widget.
* @return array The filtered arguments for tag cloud widget.
*/
function twentytwelve_widget_tag_cloud_args( $args ) {
$args['largest'] = 22;
$args['smallest'] = 8;
$args['unit'] = 'pt';
$args['format'] = 'list';
return $args;
}
add_filter( 'widget_tag_cloud_args', 'twentytwelve_widget_tag_cloud_args' );

View File

@ -1450,6 +1450,20 @@ a.comment-edit-link:hover {
display: block;
text-align: right;
}
.tagcloud ul {
list-style-type: none;
}
.tagcloud ul li {
display: inline-block;
}
.widget-area .widget.widget_tag_cloud li {
line-height: 1;
}
.template-front-page .widget-area .widget.widget_tag_cloud li {
margin: 0;
}
/* =Plugins
----------------------------------------------- */
@ -1460,7 +1474,6 @@ img#wpstats {
margin: 0 auto 1.714285714rem;
}
/* =Media queries
-------------------------------------------------------------- */