Define new post type for each custom content type

For this option a new type of post would appear below “Post”.  Each type could use their own separate categories and tags or use the same as other post types.  The content can be managed with the Advanced Custom Field plugin.  This can be implemented with a call to register_post_type, for example

function afgd5ct_setup_member_shares_post_type() {
 
  $labels = array(
    'name'               => _x( 'Shares', 'post type general name' ),
    'singular_name'      => _x( 'Share', 'post type singular name' ),
    'add_new'            => _x( 'Add New', 'post' ),    //not sure what the second context argument should be
    'add_new_item'       => __( 'Add New Share' ),
    'edit_item'          => __( 'Edit Share' ),
    'new_item'           => __( 'New Share' ),
    'all_items'          => __( 'All Shares' ),
    'view_item'          => __( 'View Share' ),
    'search_items'       => __( 'Search Shares' ),
    'not_found'          => __( 'No shares found' ),
    'not_found_in_trash' => __( 'No shares found in the Trash' ), 
    'parent_item_colon'  => '',
    'menu_name'          => 'Member Shares'
  );
  $args = array(
    'labels'        => $labels,
    'description'   => 'Holds member shared content',
    'public'        => true,
    'menu_position' => 5,
    'supports'      => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
    'has_archive'   => true,
    'taxonomies'    => array( 'category', 'post_tag' ),
    'hierarchical'  => false,
  );
  register_post_type( 'afgd5ctmembershares', $args );
 
}
add_action( 'init', 'afgd5ct_setup_member_shares_post_type' );

Leave a Comment