Skip to content

Instantly share code, notes, and snippets.

@jimmy89Li
Created April 10, 2016 12:55
Show Gist options
  • Save jimmy89Li/866b5290848b7b86223aa4354600bdf2 to your computer and use it in GitHub Desktop.
Save jimmy89Li/866b5290848b7b86223aa4354600bdf2 to your computer and use it in GitHub Desktop.
Create a custom post type in WordPress (called Press) with Featured Image option included
<?php
// Create custom press posts
add_action( 'init', 'create_posttype' );
add_theme_support('post-thumbnails');
add_post_type_support( 'press', 'thumbnail' ); // Add Featured Image for Press Posts
function create_posttype() {
register_post_type( 'press',
array(
'labels' => array(
'name' => __( 'Press' ),
'singular_name' => __( 'Press' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'press'),
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment