WordPress comes with excerpts for posts built-in. If you want to enable excerpts for pages on your website, you can easily do so. Pages in WordPress are a custom post type. And you can enable excerpts for any custom post type.

So, if you want to enable page excerpts in WordPress, you first need to edit your theme’s functions.php file and add this code:

function my_init_method() {
	add_post_type_support( 'page', 'excerpt' );
}
add_action('init', 'my_init_method');

The code above adds support for the excerpt on pages. This is useful if you’re using pages as part of your content strategy and want to be able to add excerpts to those pages.

You can use the above code to add excerpt support to any custom post type:

function my_init_method() {
	add_post_type_support( 'my-custom-post-type', 'excerpt' );
}
add_action('init', 'my_init_method');

Pin It on Pinterest

Share This