Created
July 21, 2016 22:13
-
-
Save stephanieleary/7dce0d3c34807d2f77df9d19c2e417cd to your computer and use it in GitHub Desktop.
Force Genesis Featured Page widget to use excerpts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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