-
johnmcintyre
Google PageSpeed Insights wants me to add an aria-label=”” to my logo to increase my accessibility score.
How can I add this in GP or GB?
-
You can use a filter like this:https://docs.generatepress.com/article/generate_logo_output/
In your case, try this, replace
something
with the actual aria-label you want to use.add_filter( 'generate_logo_output', 'tu_logo_target', 10, 3 ); function tu_logo_target( $output, $logo_url, $html_attr ) { printf( '<div class="site-logo"> <a href="%1$s" title="%2$s" rel="home" aria-label="something" rel="noopener"> <img %3$s /> </a> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), $html_attr ); }
-
johnmcintyre
Great, thanks Ying.
Where do I put this? Functions.php?
-
You can use one of the methods introduced here:
Adding PHP: https://docs.generatepress.com/article/adding-php/
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.