Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Site logo / title accessibility
  • Loading branch information
bschneidewind committed Feb 2, 2025
commit 8d6876b2362bf11a2d7dcd2e7956b9cc1c0390f1
19 changes: 11 additions & 8 deletions src/wp-content/themes/twentytwenty/inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@
$classname = '';

$defaults = array(
'logo' => '%1$s<span class="screen-reader-text">%2$s</span>',
'logo_class' => 'site-logo',
'title' => '<a href="%1$s">%2$s</a>',
'title_class' => 'site-title',
'home_wrap' => '<h1 class="%1$s">%2$s</h1>',
'single_wrap' => '<div class="%1$s faux-heading">%2$s</div>',
'condition' => ( is_front_page() || is_home() ) && ! is_page(),
'logo' => '%1$s<span class="screen-reader-text">%2$s</span>',
'logo_class' => 'site-logo',
'home_title' => '<a href="%1$s" aria-current="page" rel="home">%2$s</a>',
'single_title' => '<a href="%1$s" rel="home">%2$s</a>',
'title_class' => 'site-title',
'home_wrap' => '<h1 class="%1$s">%2$s</h1>',
'single_wrap' => '<div class="%1$s faux-heading">%2$s</div>',
'condition' => ( is_front_page() || is_home() ) && ! is_page(),
);

$args = wp_parse_args( $args, $defaults );
Expand All @@ -59,11 +60,13 @@
*/
$args = apply_filters( 'twentytwenty_site_logo_args', $args, $defaults );

$titlewrap = $args['condition'] ? 'home_title' : 'single_title';

if ( has_custom_logo() ) {
$contents = sprintf( $args['logo'], $logo, esc_html( $site_title ) );
$classname = $args['logo_class'];
} else {
$contents = sprintf( $args['title'], esc_url( get_home_url( null, '/' ) ), esc_html( $site_title ) );
$contents = sprintf( $args[$titlewrap], esc_url( get_home_url( null, '/' ) ), esc_html( $site_title ) );

Check failure on line 69 in src/wp-content/themes/twentytwenty/inc/template-tags.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Array keys must be surrounded by spaces unless they contain a string or an integer.
$classname = $args['title_class'];
}

Expand Down
Loading