Enabling WordPress Excerpts on Pages

By default WordPress enables excerpts on posts, but not pages.

If you’re using The Genesis Framework and setting up content via Featured posts/pages it is very useful to be able to control how the excerpt is shown.

As an example, the Genesis Featured Widget Amplified allows the placement of either the excerpt or a limited sample of the content.  Unfortunately by default the excerpt will be auto generated for pages which means that you have no control over the format.

How To Enable WordPress Excerpts on Pages

If you’re using Genesis (or most WordPress themes) it is as simple as adding the following code to the functions.php file within your theme (Child theme!)

/** Add excertps for pages */
add_post_type_support( 'page', 'excerpt' );

This adds an “excerpts” box in the page edit screen.  You may need to enable it on the “screen options” tab (top right of the screen)

That’s great, but you ideally there will be a link at the end of the text to allow the reader to continue reading.  There are various suggestions about how to deal with this,  and Greg Rickaby’s genesis code snippets has a neat solution:

"add_filter( 'excerpt_more', 'child_read_more_link' );
add_filter( 'get_the_content_more_link', 'child_read_more_link' );
add_filter( 'the_content_more_link', 'child_read_more_link' );
 * Custom Read More link.
 * @author Greg Rickaby
 * @since 1.0.0
function child_read_more_link() {
	return'Continue Reading...';

However, this does not work when using the Genesis Featured Widget Amplified plugin.

So instead you can use this code (taken from the WordPress codex) which adds the “Read More” to manually created excerpts:

function excerpt_read_more_link($output) {
 global $post;
 return $output . '<a href="'. get_permalink($post->ID) . '"> Read More...</a>';
add_filter('the_excerpt', 'excerpt_read_more_link');

So, there you have handcrafted WordPress Excerpts on pages complete with a “Read More” link.  You could of course add “no follow” to the link if you wished, or even pull the post title as the link.