Skip to content

Instantly share code, notes, and snippets.

@kisabelle
Created May 29, 2018 18:55
Show Gist options
  • Save kisabelle/42ef25745668063cfc91f8b20506d446 to your computer and use it in GitHub Desktop.
Save kisabelle/42ef25745668063cfc91f8b20506d446 to your computer and use it in GitHub Desktop.
function register_post_types() {
//this is where you can register custom post types
function custom_posts($name, $single, $menu_order, $meta_cap, $capability_type, $supports, $taxonomies) {
register_post_type( $name, array(
'labels' => array(
'name' => _x( ucfirst($name), 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( ucfirst($single), 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( ucfirst($name), 'text_domain' ),
'name_admin_bar' => __( ucfirst($name), 'text_domain' ),
),
'description' => __( 'Custom Post Type', 'text_domain' ),
'capability_type' => 'post',
'menu_icon' => 'dashicons-admin-post',
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'menu_position' => $menu_order,
'map_meta_cap' => $meta_cap,
'capability_type' => $capability_type,
'supports' => $supports,
'taxonomies' => $taxonomies,
) );
}
custom_posts('events', 'event', 20, true,
array( 'custom_post','custom_posts' ),
array( 'title', 'editor', 'excerpt', 'thumbnail', ),
array( )
);
custom_posts('news', 'news', 21, true,
array( 'custom_post','custom_posts' ),
array( 'title', 'editor', 'excerpt', 'thumbnail', ),
array( 'category' )
);
custom_posts('jobs', 'job', 22, true,
array( 'job_post','job_posts' ),
array( 'title', 'editor', ),
array( )
);
custom_posts('directors', 'director', 23, true,
array( 'custom_post','custom_posts' ),
array( 'title', 'thumbnail', 'page-attributes' ),
array( )
);
custom_posts('staff', 'member', 24, true,
array( 'custom_post','custom_posts' ),
array( 'title', 'thumbnail', ),
array( )
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment