Add understrap_edit_post_link() to display the edit post link

This commit is contained in:
IanDelMar 2021-07-26 07:10:05 +02:00
parent 2f3860826c
commit 8929d7f6b9
2 changed files with 19 additions and 10 deletions

View File

@ -73,15 +73,7 @@ if ( ! function_exists( 'understrap_entry_footer' ) ) {
comments_popup_link( esc_html__( 'Leave a comment', 'understrap' ), esc_html__( '1 Comment', 'understrap' ), esc_html__( '% Comments', 'understrap' ) );
echo '</span>';
}
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'understrap' ),
the_title( '<span class="sr-only">"', '"</span>', false )
),
'<span class="edit-link">',
'</span>'
);
understrap_edit_post_link();
}
}
@ -157,3 +149,20 @@ if ( ! function_exists( 'understrap_body_attributes' ) ) {
echo trim( $attributes ); // phpcs:ignore WordPress.Security.EscapeOutput
}
}
if ( ! function_exists( 'understrap_edit_post_link' ) ) {
/**
* Displays the edit post link for post.
*/
function understrap_edit_post_link() {
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'understrap' ),
the_title( '<span class="sr-only">"', '"</span>', false )
),
'<span class="edit-link">',
'</span>'
);
}
}

View File

@ -36,7 +36,7 @@ defined( 'ABSPATH' ) || exit;
<footer class="entry-footer">
<?php edit_post_link( __( 'Edit', 'understrap' ), '<span class="edit-link">', '</span>' ); ?>
<?php understrap_edit_post_link(); ?>
</footer><!-- .entry-footer -->