Add multiple post types?
-
Hello, I am trying to add two post types to my WordPress. I used the following code in my functions.php file and only the first one “Web Design” is working.
if( ! function_exists( 'portfolio_post_types' ) ) { function portfolio_post_types() { register_post_type( 'web-design-portfolio', array( 'labels' => array( 'name' => __( 'Web Design', 'web-design-portfolio' ), 'singular_name' => __( 'Website', 'web-design-portfolio' ), 'add_new' => __( 'Add New', 'web-design-portfolio' ), 'add_new_item' => __( 'Add New Website', 'web-design-portfolio' ), 'edit' => __( 'Edit', 'web-design-portfolio' ), 'edit_item' => __( 'Edit Website', 'web-design-portfolio' ), 'new_item' => __( 'New Website', 'web-design-portfolio' ), 'view' => __( 'View Website', 'web-design-portfolio' ), 'view_item' => __( 'View Website', 'web-design-portfolio' ), 'search_items' => __( 'Search Websites', 'web-design-portfolio' ), 'not_found' => __( 'No website found', 'web-design-portfolio' ), 'not_found_in_trash' => __( 'No websites found in Trash', 'web-design-portfolio' ), 'parent' => __( 'Parent Website', 'web-design-portfolio' ), ), 'description' => __( 'Create a Website.', 'web-design-portfolio' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'menu_position' => 6, 'hierarchical' => true, 'query_var' => true, 'supports' => array ( 'title', //Text input field to create a post title. 'editor', 'thumbnail' ) ) ); register_post_type( 'graphic-design-portfolio', array( 'labels' => array( 'name' => __( 'Graphic Design', 'graphic-design-portfolio' ), 'singular_name' => __( 'Graphic Design', 'graphic-design-portfolio' ), 'add_new' => __( 'Add New', 'graphic-design-portfolio' ), 'add_new_item' => __( 'Add New Artwork', 'graphic-design-portfolio' ), 'edit' => __( 'Edit', 'graphic-design-portfolio' ), 'edit_item' => __( 'Edit Artwork', 'graphic-design-portfolio' ), 'new_item' => __( 'New Artwork', 'graphic-design-portfolio' ), 'view' => __( 'View Artwork', 'graphic-design-portfolio' ), 'view_item' => __( 'View Artwork', 'graphic-design-portfolio' ), 'search_items' => __( 'Search Artwork', 'graphic-design-portfolio' ), 'not_found' => __( 'No Artwork found', 'graphic-design-portfolio' ), 'not_found_in_trash' => __( 'No Artwork found in Trash', 'graphic-design-portfolio' ), 'parent' => __( 'Parent Artwork', 'graphic-design-portfolio' ), ), 'description' => __( 'Create an Artwork Piece.', 'graphic-design-portfolio' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'menu_position' => 11, 'hierarchical' => true, 'query_var' => true, 'supports' => array ( 'title', //Text input field to create a post title. 'editor', 'thumbnail' ) ) ); } } add_action( 'init', 'portfolio_post_types' ); // register post type
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add multiple post types?’ is closed to new replies.