Created
April 17, 2015 20:36
-
-
Save joeydsmith/d28fe8e822c9ec95870e to your computer and use it in GitHub Desktop.
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
################################ | |
# START __posttype__ | |
################################ | |
function register__posttype__() { | |
$cpt_single = '__single__'; | |
$cpt_plural = '__plural__'; | |
$cpt_icon = '__icon__'; | |
$rewrite = array('slug' => '__slug__', 'with_front' => true); | |
$exclude_from_search = __exclude__; | |
// Admin Labels | |
$labels = array( | |
'name' => _x( $cpt_plural, 'post type general name' ), | |
'singular_name' => _x( $cpt_single, 'post type singular name' ), | |
'add_new' => __( 'Add New ' . $cpt_single ), | |
'add_new_item' => __( 'Add New ' . $cpt_single ), | |
'edit_item' => __( 'Edit ' . $cpt_single ), | |
'new_item' => __( 'New ' . $cpt_single ), | |
'all_items' => __( 'All ' . $cpt_plural ), | |
'view_item' => __( 'View ' . $cpt_single . ' Page' ), | |
'search_items' => __( 'Search ' . $cpt_plural ), | |
'not_found' => __( 'No '. $cpt_plural .' found' ), | |
'not_found_in_trash' => __( 'No '. $cpt_plural .' found in the Trash' ), | |
'parent_item_colon' => '', | |
'menu_name' => $cpt_plural | |
); | |
// Arguments | |
$args = array( | |
'labels' => $labels, | |
'description' => 'Manage '. $cpt_plural, | |
'public' => true, | |
'menu_position' => 10, | |
'hierarchical' => true, | |
'supports' => array( 'title', 'editor', 'page-attributes', 'thumbnail', 'excerpt' ), | |
'has_archive' => true, | |
'menu_icon' => $cpt_icon, | |
'rewrite' => $rewrite, | |
'exclude_from_search' => $exclude_from_search | |
); | |
// Just do it | |
register_post_type( '__posttype__', $args ); | |
} | |
// Hook into the 'init' action | |
add_action( 'init', 'register__posttype__', 0 ); | |
################################ | |
# END __posttype__ | |
################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment