[Support request] Alt text for Logo.

Home Forums Support [Support request] Alt text for Logo.

Home Forums Support Alt text for Logo.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2284305
    Zee

    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!

    #2284336
    David
    Staff
    Customer Support

    Hi there,

    this is the correct filter:

    https://docs.generatepress.com/article/generate_logo_title/

    If you have page caching – try clearing that after adding it.
    If still an issue it may be because you have a plugin that is switching the images to webP and that may be interfering.

    #2363009
    KKale

    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

    #2363194
    Ying
    Staff
    Customer Support

    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 ) )
    		);
    }
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.