Site logo

Archived topic

ARIA Label von Logo ändern

7 replies · Started by Oliver on June 24, 2021

Viewing posts 1–8 of 8

Hi,

Wie ist es möglich, ein ARIA Label von dem Logo der Website zu ändern?
Der Name sollte vom Screenreader zum Beispiel mit "Zur Startseite wechseln" ausgegeben werden.
Danke für einen Lösungsansatz.

Hi Oliver,

Here's a filter that can alter the logo html output, it's mainly for changing the size of logo.
https://docs.generatepress.com/article/generate_logo_output/#setting-a-width-and-height

But you can also add the aria label to the php:

For example:

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="%2$s" rel="home">
				<img width="200" height="200" class="header-image" src="%3$s" alt="%2$s" title="%2$s" aria-label="Zur Startseite wechseln"  />
			</a>
		</div>',
		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
		esc_url( apply_filters( 'generate_logo', $logo ) )
	);
}

Change the widthand height value to match your current logo setting.

How to add PHP: https://docs.generatepress.com/article/adding-php/

Let me know if this helps :)

Hallo Ying,

über das Plugin Code Snippets habe ich es hinbekommen.
Das Hinzufügen des Filters über ein Child Theme und die zugehörige functions.php war nicht erfolgreich.
Ich hoffe, dass das Plugin Code Snippets nicht die Performance insgesamt belastet.

Mit welchem Filter kann man die ARIA Labels von Social Media Icons im Footer ändern?

Danke!

For the social icons in the footer, I don't think PHP is needed.

Could you link me to your site using the private info field?

Hallo Ying!

Die Icons im Footer sind bereits eingebaut. Es gibt auch ARIA Labels, aber ich würde sie gern anders nennen.
Anstelle "LinkedIn Link" sollte "Firmenname auf LinkedIn" vom Screenreader erkannt und gelesen werden.
Den Link findest du im privaten Infofeld.

Hi Oliver,

Seems the social icons are added with Light weight social icons, this plugin was created by Tom, but now it's kinda out of date.

I would recommend using Generateblocks plugin, and use Block element to add the social icons instead.

Buttons block of Generateblocks: https://docs.generateblocks.com/article/buttons-overview/#aria-label

In this way, you are allowed to add ARIA label to each icons.

Here's a tutorial video about how to add social icons to top bar using Generateblocks.
https://youtu.be/yAleVWQi5EA?t=98

In your case, you will use Hook as element (same as in the video), use before footer as hook name (different from the video).

Let me know if this helps :)

Hallo Ying,

ich habe das gewünschte Ziel erreicht!
Vielen Dank für die Hilfe.

Viele Grüße

Great!

Really glad to hear that :)

This archived topic is closed to new replies.