Last active
April 16, 2019 14:19
-
-
Save wpspeak/5997576 to your computer and use it in GitHub Desktop.
Create a simple Portfolio Custom Post Type
This file contains 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 portfolio custom post type | |
add_action( 'init', 'register_cpt_portfolio' ); | |
function register_cpt_portfolio() { | |
register_post_type( 'portfolio', | |
array( | |
'labels' => array( | |
'name' => __( 'Portfolio', 'portfolio' ), | |
'singular_name' => __( 'Portfolio', 'portfolio' ), | |
), | |
'exclude_from_search' => true, | |
'has_archive' => true, | |
'hierarchical' => true, | |
'public' => true, | |
'rewrite' => array( 'slug' => 'portfolio' ), | |
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ), | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment