Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Display Manual Excerpts Below Page Titles
//* Add Excerpt support to Pages
add_post_type_support( 'page', 'excerpt' );
//* Output Excerpt on Pages
add_action( 'genesis_meta', 'lwp_page_description_meta' );
function lwp_page_description_meta() {
if ( is_singular() && is_page() && has_excerpt() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_after_header', 'lwp_open_after_header', 5 );
add_action( 'genesis_after_header', 'lwp_add_page_description', 10 );
add_action( 'genesis_after_header', 'lwp_close_after_header', 15 );
}
}
function lwp_add_page_description() {
echo '<div class="page-description">';
echo '<h1 itemprop="headline" class="page-title">' . get_the_title() . '</h1>';
echo '<p>' . get_the_excerpt() . '</p></div>';
}
function lwp_open_after_header() {
echo '<div class="after-header"><div class="wrap">';
}
function lwp_close_after_header() {
echo '</div></div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment