This tutorial provides the PHP code which enables you to insert a hand crafted or manual excerpt between your single post titles (entry title) and the post info ( entry meta – entry header ).
Here’s what i’m referring to:
- Entry title or single post title
- Excerpt
- Post info or entry meta in entry header
- Entry content
You can use this code in your functions file or single.php file:
add_action( 'genesis_entry_header', 'wpsites_excerpt', 11 );
function wpsites_excerpt() {
if ( is_singular( 'post' ) && has_excerpt() ) {
the_excerpt();
}
}
Wrap The Excerpt in Heading Tags
This code wraps the excerpt in h2 tags:
add_action( 'genesis_entry_header', 'wpsites_excerpt', 11 );
function wpsites_excerpt() {
if ( is_singular( 'post' ) && has_excerpt() ) {
printf( '<h2>%s</h2>', get_the_excerpt() );
}
}
The solution in this post answers this question:
I’d like to include an excerpt in between the post title and the meta, but it seems like the hook that allows this has been deprecated.
Leave a Reply
You must be logged in to post a comment.