
Add Manual Exceprts to Pages in WordPress
Excerpts in WordPress are sometimes used as preview text on an archive page (like a blog or category page).
WordPress themes usually enable excerpts on Posts by default.
If you are editing a post, and don’t see the field for Excerpt, it is probably hidden under the Screen Options tab in the top right corner. [See Figure 1 below].
Does WordPress enable manual excerpts on Pages by default?
Pages and Custom Post Types do not have support for manual excerpts “out-of-the-box”.
Figure 1: Screen Options tab and Excerpt checkbox.
Adding Support for Excerpts to Pages in WordPress
Here is a code snippet you can add to your functions.php
file to add excerpts.
/**
* Add manual excerpts for Pages
*/
add_action( 'init', 'ld_add_excerpts_to_pages' );
function ld_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
Adding Support for Excerpts to Custom Post Types in WordPress
Do you need to add manual excerpts for custom post types? Add this code snippet to your functions.php
file, and it will do the trick. Be sure to switch out your-post-type
in the first parameter for the name of the custom post type where you want to add excerpts.
/**
* Add manual excerpts for Custom Post Types
*/
add_action( 'init', 'ld_add_excerpts_to_cpt' );
function ld_add_excerpts_to_cpt() {
add_post_type_support( 'your-post-type', 'excerpt' );
}