Created
April 10, 2016 12:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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