Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated h2 in template-tags.php #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
36 changes: 25 additions & 11 deletions inc/helpers/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,39 @@ function blank_theme_entry_footer() {
}

/**
* Get site title.
* Get site title with additional context.
*
* @param string $title_class Show or hide title.
*
* @return void
*/
function blank_theme_site_title( $title_class = '' ) {
$title_format = '<h2 class="site-title %s"><a href="%s" rel="home">%s</a></h2>';

if ( is_front_page() && is_home() ) {
$title_format = '<h1 class="site-title %s"><a href="%s" rel="home">%s</a></h1>';
$title_format = '<h2 class="site-title %s">%s</h2>'; // Change to use <h2> for site title

$site_name = get_bloginfo( 'name', 'display' );
$site_description = get_bloginfo( 'description', 'display' );

// Check if a site description is available.
if ( $site_description ) {
$site_title = sprintf(
$title_format,
esc_attr( $title_class ),
'<a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' .
'<span class="site-name">' . esc_html( $site_name ) . '</span>' .
'<span class="site-description">' . esc_html( $site_description ) . '</span>' .
'</a>'
);
} else {
$site_title = sprintf(
$title_format,
esc_attr( $title_class ),
'<a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' .
'<span class="site-name">' . esc_html( $site_name ) . '</span>' .
'</a>'
);
}

printf(
$title_format, // phpcs:ignore
esc_attr( $title_class ),
esc_url( home_url( '/' ) ),
get_bloginfo( 'name', 'display' ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
echo $site_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

/**
Expand Down