Site logo

Archived topic

Alt text for Logo.

3 replies · Started by Zee on July 16, 2022

Viewing posts 1–4 of 4

Hi there -

I'm having issues trying to modify the alt text for my website's logo. I've tried all the filters suggested here, adding them into Snippets: https://generatepress.com/forums/topic/site-logo-alt-tag-filter/ but the logo's alt text still just shows the site title.

Any help would be much appreciated!

Hi David,

generate_logo_title changes both the title and alt attributes.

We are hoping to make the title and the alt text to be a different.

Thanks

Hi Kale,

You can try generate_logo_output filter, you can replace the my alt text and my logo title:

add_filter( 'generate_logo_output','tu_logo_atts', 10, 2 ); 
function tu_logo_atts( $output, $logo ) {
	printf(
		'<div class="site-logo">
			<a href="%1$s" title="my logo title" rel="home" alt="my alt text">
						<img class="header-image" src="%2$s" alt="my alt text" title="my logo title" />
					</a>
		</div>',
		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
		esc_url( apply_filters( 'generate_logo', $logo ) )
		);
}
This archived topic is closed to new replies.