Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Force Genesis Featured Page widget to use excerpts
<?php
//* Add excerpts to pages
add_post_type_support( 'page', 'excerpt' );
//* Use excerpts as Featured Page widget content
add_filter( 'get_the_content_limit', 'ebca_content_limit', 10, 4 );
function ebca_content_limit( $output, $content, $link, $max_characters ) {
$content = get_post_field( 'post_excerpt', get_the_ID() );
$output = sprintf( '<p>%s <br /> %s</p>', $content, $link );
return $output;
}
//* If 'more' link shows default text instead of widget setting, override with...
add_filter( 'get_the_content_more_link', 'ebca_more_link', 10, 2 );
function ebca_more_link( $link, $text ) {
return sprintf( '<a href="%s" class="button more-link">%s</a>', get_permalink(), $text );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment