WordPress Custom Post Types


add_action( ‘init’, ‘create_post_type’ );
function create_post_type() {
  register_post_type( ‘slider’,
    array(
      ‘labels’ => array(
        ‘name’ => __( ‘Sliders’ ),
        ‘singular_name’ => __( ‘Slider’ )
      ),
      ‘public’ => true,
      ‘has_archive’ => true,
 ‘supports’ => array(‘title’, ‘thumbnail’),
    )
  );
}
  • ‘title’
  • ‘editor’ (content)
  • ‘author’
  • ‘thumbnail’ (featured image) (current theme must also support Post Thumbnails)
  • ‘excerpt’
  • ‘trackbacks’
  • ‘custom-fields’ (see Custom_Fields, aka meta-data)
  • ‘comments’ (also will see comment count balloon on edit screen)
  • ‘revisions’ (will store revisions)
  • ‘page-attributes’ (template and menu order) (hierarchical must be true)
  • ‘post-formats’ (see Post_Formats)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s