No excerpt for pages in WordPress?

Pages do not offer manual excerpts by default
So, I wanted to add a small modification to my WordPress theme to use the (manual) excerpt as a meta-description tag and found out that there is no way to set the excerpt for pages but only for posts. Really? I found that hard to believe.
The truth is that pages can have excerpts, but they are disabled by default for some unknown reason. I'm sure there is even a valid reason, but I still want to use excerpts for pages.
The solution is actually a one-liner and can be added to any theme.
add_post_type_support('page', 'excerpt');
The correct place to add this line of code is your theme's functions.php file and the code should execute in the init hook.
add_action ('init', 'theme_init');
function theme_init()
{
add_post_type_support( 'page', 'excerpt' );
}
This is all. After doing this, excerpts can be used for pages. Note that your WordPress admin UI might still hide the excerpt section from the page editor. Click the Screen Options link in the top right corner of the page editor and make sure the Excerpt check box is ticked.
if(is_singular() && $post->post_excerpt != '') {
echo '<meta name="description" content="',the_excerpt_rss(),'" />';
}
The above code will then generate a meta description tag from your excerpt and should ideally go into your header.php template. The reason for using the_excerpt_rss() is that this function will strip the excerpt from all formatting tags, essentially converting it into plain text.
