From c60811bf942d6873dfd8a7e17a8658b5cb42dc30 Mon Sep 17 00:00:00 2001 From: "David A. Kennedy" Date: Fri, 26 Jun 2015 14:22:38 -0400 Subject: [PATCH] Add post title to `edit_post_link` This improves the accessibility of these links, and gives more context for screen reader users. Now, they know exactly where the link goes. Escaped output with `esc_html_x` and `wp_kses`. Resolves: #774 --- inc/template-tags.php | 9 ++++++++- template-parts/content-page.php | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index fb865c04..e9ab2842 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -123,7 +123,14 @@ function _s_entry_footer() { echo ''; } - edit_post_link( esc_html__( 'Edit', '_s' ), '', '' ); + edit_post_link( + sprintf( + esc_html_x( 'Edit %s', 'name of current post', '_s' ), + wp_kses( the_title( '"', '"', false ), array( 'span' => array( 'class' => array() ) ) ) + ), + '', + '' + ); } endif; diff --git a/template-parts/content-page.php b/template-parts/content-page.php index f0601c5c..e837d964 100644 --- a/template-parts/content-page.php +++ b/template-parts/content-page.php @@ -23,7 +23,16 @@