Skip to content

Commit b1b13f5

Browse files
committed
Merge pull request #775 from davidakennedy/editlinkposttitle
Add post title to `edit_post_link`
2 parents 8cd7903 + 78147d4 commit b1b13f5

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

inc/template-tags.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ function _s_entry_footer() {
6565
echo '</span>';
6666
}
6767

68-
edit_post_link( esc_html__( 'Edit', '_s' ), '<span class="edit-link">', '</span>' );
68+
edit_post_link(
69+
sprintf(
70+
/* translators: %s: Name of current post */
71+
esc_html__( 'Edit %s', '_s' ),
72+
the_title( '<span class="screen-reader-text">"', '"</span>', false )
73+
),
74+
'<span class="edit-link">',
75+
'</span>'
76+
);
6977
}
7078
endif;
7179

template-parts/content-page.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@
2525
</div><!-- .entry-content -->
2626

2727
<footer class="entry-footer">
28-
<?php edit_post_link( esc_html__( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
28+
<?php
29+
edit_post_link(
30+
sprintf(
31+
/* translators: %s: Name of current post */
32+
esc_html__( 'Edit %s', '_s' ),
33+
the_title( '<span class="screen-reader-text">"', '"</span>', false )
34+
),
35+
'<span class="edit-link">',
36+
'</span>'
37+
);
38+
?>
2939
</footer><!-- .entry-footer -->
3040
</article><!-- #post-## -->
3141

0 commit comments

Comments
 (0)