Charles
Charles

Reputation: 119

How do I add an Excerpt box to custom post types in functions?

I just want the standard Excerpt box - not a metabox of my own creation, added to a Custom Post. The box shows up in Posts but not in Custom Posts. I've tried both of these older solutions but neither of them worked (maybe it's a WP 3.9 problem):

The custom post type name is "Scoop"

I added this to the register_post_type_scoop() $labels = array

'supports' => array('title','thumbnail','excerpt')

but it didn't work - neither did this:

add_post_type_support('Scoop', 'title');
add_post_type_support('Scoop', array('title', 'thumbnail', 'excerpt') );

Upvotes: 0

Views: 5558

Answers (1)

Sarower Jahan
Sarower Jahan

Reputation: 1495

Add a index value excerpt to the supports object. Below the example is:

add_action( 'init', 'create_testimonial_posttype' );
function create_testimonial_posttype(){
  register_post_type( 'testimonials',
    array(
      'labels' => array(
        'name' => __( 'Testimonials' ),
        'singular_name' => __( 'Testimonial' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'clients'),
      'supports' => array('title','thumbnail','editor','page-attributes','excerpt'),
    )
  );
}

Upvotes: 1

Related Questions