• Resolved brodiebrodie

    (@brodiebrodie)


    Hi,
    I am using post masonry and I would like to find a way to dynamically add the post title to the read more link in order to improve accessibility. Alternatively a way to add the title into screen reader text would also work.
    Best
    Brodie

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @brodiebrodie ,

    Unfortunately, as of now, there is no direct option for that.

    However, this can be achieved using the custom code. Like this.

    You can use the following filter in the functions.php file of your child theme:

    function single_post_excerpt_after( $post_id, $attributes ) {
        echo sprintf('<div class="uagb-post__text"> 
    		<div class="uagb-post__cta">
    			<a class="uagb-post__link uagb-text-link" href="%1$s" target="_self" rel="bookmark noopener noreferrer">%2$s</a>
    		</div>
    	</div>',esc_url( get_permalink( $post_id ) ),esc_html( get_the_title($post_id) )); 
    } 
    add_action( 'uagb_single_post_after_excerpt_masonry', 'single_post_excerpt_after', 10, 2 );

    Note: You can hide the “Read More” button from here.

    I hope that helps. Let me know how it goes.

    Regards,
    Sweta

    Hello @brodiebrodie ,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add post title to read more’ is closed to new replies.