- This topic has 9 replies, 2 voices, and was last updated 4 years, 7 months ago by Tom.
-
AuthorPosts
-
August 12, 2019 at 3:35 pm #982456Karen
WordPress, all plugins and themes using latest versions.
I am using the WP Accessibility plugin by Joe Dolson and testing with the WAVE browser extension.
I am using the site logo in my header. The site title set to hidden.
In the customizer, I enter the site title and that text is used as:
the link title tag
the logo alt text
logo title textWave error message is:
Redundant title text
Title attribute text is the same as text or alternative text.It is also giving me an error with the skip to content. Because that link has a title tag that is the same as the link text.
My issue is the same as #824891. I have tried the fix provided there for the skip to content – but it made no change.
August 12, 2019 at 4:54 pm #982487TomLead DeveloperLead DeveloperHi there,
This looks like something we need to clean up.
Which one would you like to keep? The link title tag, logo alt text or the logo title text?
Let me know π
August 12, 2019 at 5:13 pm #982495KarenThis is were I get confused with the accessibility requirements. They tell you to have title text for links then you get an error if it is the same as the link text. They tell you to have alt text on every image.
As I understand it the issue is more that the text is exactly the same than that it is there. Would it be possible to have the option to change the title text for these two links somewhere?
I have it set differently in the media gallery, but that does not show up here.
In my testing I temporarily deleted the site title in the customizer (not something I want to do) and it solved the redundant text but created an error since there was no alt text.August 13, 2019 at 9:45 am #983195TomLead DeveloperLead DeveloperLet’s try this:
add_filter( 'generate_logo_attributes', function( $atts ) { unset( $atts['title'] ); return $atts; } ); add_filter( 'generate_logo_output', function( $output, $logo_url, $attrs ) { return sprintf( // WPCS: XSS ok, sanitization ok. '<div class="site-logo"> <a href="%1$s" title="Back Home" rel="home"> <img %2$s /> </a> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), $attrs ); }, 10, 3 );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know π
August 13, 2019 at 10:29 am #983233KarenI added the code to my child theme functions.php file and I get the following error. line 18 is the line with add_filter( ‘generate_logo_output’, function
Your PHP code changes were rolled back due to an error on line 18 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.
Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in wp-content/themes/generatepress_child/functions.php:18
Stack trace:
#0 wp-includes/class-wp-hook.php(288): {closure}(‘<div class=”sit…’)
#1 wp-includes/plugin.php(208): WP_Hook->apply_filters(‘<div class=”sit…’, Array)
#2 wp-content/themes/generatepress/inc/structure/header.php(144): apply_filters(‘generate_logo_o…’, ‘<div class=”sit…’, ‘https://fbc2019…’, ‘ class=”header-…’)
#3 wp-content/themes/generatepress/inc/structure/header.php(75): generate_construct_logo()
#4 wp-content/themes/generatepress/inc/structure/header.php(32): generate_header_items()
#5 wp-includes/class-August 13, 2019 at 4:28 pm #983489TomLead DeveloperLead DeveloperAh, sorry about that. Can you try the updated code?: https://generatepress.com/forums/topic/redundant-title-text/#post-983195
August 13, 2019 at 5:10 pm #983510KarenNo errors but also no logo. I appreciate your help but I do not want to take up more of your time. I am going to just live with having the redundant text error.
August 13, 2019 at 5:17 pm #983513TomLead DeveloperLead DeveloperUgh – sorry. I just made another change (and tested it). All should be good to go π
August 13, 2019 at 5:34 pm #983520KarenThat did it. No error on the logo now. Many thanks.
August 14, 2019 at 9:25 am #984158TomLead DeveloperLead DeveloperAwesome, glad I could help π
-
AuthorPosts
- You must be logged in to reply to this topic.