Archived topic
Use code to get screen reader text on skip link, now I have two Skip links
1 reply · Started by Alicia on November 22, 2020
Viewing posts 1–2 of 2
This is totally weird. I got this code here on the forum and it looks like it should remove the original skip link but it's not. So now I have two!
remove_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
add_action( 'generate_before_header', function() {
printf( '<a class="screen-reader-text skip-link" href="#content">%s</a>',
esc_html__( 'Skip to content', 'generatepress' )
);
}, 2 );
Is it a priority issue? I see them both before the header, too.
Hi,
Try this PHP snippet instead:
add_filter('after_setup_theme', function(){
remove_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 );
add_action( 'generate_before_header', function() {
printf( '<a class="screen-reader-text skip-link" href="#content">%s</a>',
esc_html__( 'Skip to content', 'generatepress' )
);
}, 2 );
});
This archived topic is closed to new replies.