Site logo

[Support request] aria-label – matching issue?

Home Forums Support [Support request] aria-label – matching issue?

Home Forums Support aria-label – matching issue?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2268657
    William

    Aloha 🙂

    I’m using a ‘Dynamic Content block’ set to ‘Post excerpt’ with the ‘Use theme more link’ selected.

    The link text is set to display as “Read more” (in Customizer)

    I end up with an aria-label that looks like this for my “Read more” link.

    aria-label=”More on [post title]”

    Is there a way to control the two words “More on”?

    My accessibility checker is telling me a better aria-label would be “Read more on”

    Thanks for any thoughts you can offer 🙂

    _bill – Hawaii

    #2268696
    Fernando
    Customer Support

    Hi William,

    Yes, there is a way and you can do it by using filter generate_excerpt_more_output.

    Reference: https://docs.generatepress.com/article/generate_excerpt_more_output/

    For instance, here’s a snippet you may try:

    add_filter('generate_excerpt_more_output', function(){
    	$new_more = sprintf(
    				' ... <a title="%1$s" class="read-more" href="%2$s" aria-label="%4$s">%3$s</a>',
    				the_title_attribute( 'echo=0' ),
    				esc_url( get_permalink( get_the_ID() ) ),
    				__( 'Read more', 'generatepress' ),
    				sprintf(
    					/* translators: Aria-label describing the read more button */
    					_x( 'Read more on %s', 'more on post title', 'generatepress' ),
    					the_title_attribute( 'echo=0' )
    				)
    			);
    	return $new_more;
    });

    Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

    Hope this helps! Kindly let us know how it goes.

    #2268698
    William

    Amazing as always 🙂

    You are all indeed … THE BEST.

    With much aloha from Hawaiʻi.

    _bill

    #2268699
    Fernando
    Customer Support

    You’re welcome Bill! Aloha!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.