If you ever find yourself needing an extra content area, saved as part of the post object, in your page template which is nice and straightforwards to access I find the best method is to add the excerpt functionality with add_post_type_support().

<?php add_post_type_support( 'page', 'excerpt'); ?>

Whilst the example above adds the ‘excerpt‘ functionality to the ‘page‘ post type, both are interchangeable, so you could define existing post types – post, page etc or a custom post type and add any of the functionality listed below (where it isn’t already in use).
title, editor, author, thumbnail, excerpt, trackbacks, custom-fields, comments, revisions, post-formats

Note: This should be added on the ‘init‘ WordPress action, so either drop it into one of your functions already being called – the one registering your post types should be firing then too or use the example below.

<?php add_action('init',function(){
  add_post_type_support( 'page', 'excerpt' );
}); ?>

Leave a Reply

Privacy & more..

Cookie Consent Policy