forked from mirror/_s
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
This commit is contained in:
parent
5bb0534358
commit
c60811bf94
|
@ -123,7 +123,14 @@ function _s_entry_footer() {
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_post_link( esc_html__( 'Edit', '_s' ), '<span class="edit-link">', '</span>' );
|
edit_post_link(
|
||||||
|
sprintf(
|
||||||
|
esc_html_x( 'Edit %s', 'name of current post', '_s' ),
|
||||||
|
wp_kses( the_title( '<span class="screen-reader-text">"', '"</span>', false ), array( 'span' => array( 'class' => array() ) ) )
|
||||||
|
),
|
||||||
|
'<span class="edit-link">',
|
||||||
|
'</span>'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,16 @@
|
||||||
</div><!-- .entry-content -->
|
</div><!-- .entry-content -->
|
||||||
|
|
||||||
<footer class="entry-footer">
|
<footer class="entry-footer">
|
||||||
<?php edit_post_link( esc_html__( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
|
<?php
|
||||||
|
edit_post_link(
|
||||||
|
sprintf(
|
||||||
|
esc_html_x( 'Edit %s', 'name of current post', '_s' ),
|
||||||
|
wp_kses( the_title( '<span class="screen-reader-text">"', '"</span>', false ), array( 'span' => array( 'class' => array() ) ) )
|
||||||
|
),
|
||||||
|
'<span class="edit-link">',
|
||||||
|
'</span>'
|
||||||
|
);
|
||||||
|
?>
|
||||||
</footer><!-- .entry-footer -->
|
</footer><!-- .entry-footer -->
|
||||||
</article><!-- #post-## -->
|
</article><!-- #post-## -->
|
||||||
|
|
||||||
|
|
Reference in New Issue