├── events ├── readme.md ├── meta.php ├── post-types.php └── taxonomies.php ├── testimonials ├── meta.php ├── readme.md ├── taxonomies.php └── post-types.php ├── portfolio ├── readme.md ├── meta.php ├── post-types.php └── taxonomies.php └── readme.md /events/readme.md: -------------------------------------------------------------------------------- 1 | # Events 2 | 3 | Incomplete standard for Events. See: https://github.com/justintadlock/content-type-standards/wiki/Content-Type:-Event -------------------------------------------------------------------------------- /events/meta.php: -------------------------------------------------------------------------------- 1 | true, 14 | 'show_ui' => true, 15 | 'show_in_nav_menus' => true, 16 | 'show_tagcloud' => true, 17 | 'show_admin_column' => true, 18 | 'hierarchical' => true, 19 | 'query_var' => 'testimonial_category', 20 | 21 | /* Capabilities. */ 22 | 'capabilities' => array( 23 | 'manage_terms' => 'manage_testimonials', 24 | 'edit_terms' => 'manage_testimonials', 25 | 'delete_terms' => 'manage_testimonials', 26 | 'assign_terms' => 'edit_testimonials', 27 | ), 28 | 29 | /* The rewrite handles the URL structure. */ 30 | 'rewrite' => array( 31 | 'slug' => 'testimonials/category', 32 | 'with_front' => false, 33 | 'hierarchical' => true, 34 | 'ep_mask' => EP_NONE 35 | ), 36 | 37 | /* Labels used when displaying taxonomy and terms. */ 38 | 'labels' => array( 39 | 'name' => __( 'Testimonial Categories', 'example-textdomain' ), 40 | 'singular_name' => __( 'Testimonial Category', 'example-textdomain' ), 41 | 'menu_name' => __( 'Categories', 'example-textdomain' ), 42 | 'name_admin_bar' => __( 'Category', 'example-textdomain' ), 43 | 'search_items' => __( 'Search Categories', 'example-textdomain' ), 44 | 'popular_items' => __( 'Popular Categories', 'example-textdomain' ), 45 | 'all_items' => __( 'All Categories', 'example-textdomain' ), 46 | 'edit_item' => __( 'Edit Category', 'example-textdomain' ), 47 | 'view_item' => __( 'View Category', 'example-textdomain' ), 48 | 'update_item' => __( 'Update Category', 'example-textdomain' ), 49 | 'add_new_item' => __( 'Add New Category', 'example-textdomain' ), 50 | 'new_item_name' => __( 'New Category Name', 'example-textdomain' ), 51 | 'parent_item' => __( 'Parent Category', 'example-textdomain' ), 52 | 'parent_item_colon' => __( 'Parent Category:', 'example-textdomain' ), 53 | 'separate_items_with_commas' => null, 54 | 'add_or_remove_items' => null, 55 | 'choose_from_most_used' => null, 56 | 'not_found' => null, 57 | ) 58 | ) 59 | ); 60 | } 61 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Content Type Standards 2 | 3 | The purpose of this repository is to create an open set of standards for the WordPress developer community on how to name custom post types as well as related taxonomies and metadata. 4 | 5 | The need for a standard on common post types has been clear for years. However, we've never taken the initiative and put together a list. We need some sort of standard, even if it's loose and flexible, so that multiple plugins can compete in the same space without users losing access to their data when switching between plugins. 6 | 7 | ## Reasons for a standard 8 | 9 | * Less worry about what to name things when creating a plugin. 10 | * We can have competing plugins in the same space. 11 | * Cool things like add-on plugins become easier to build. 12 | * Users can switch between similar plugins to find the one they like best. 13 | * It'd be easier to push for things in core WP like custom Dashicons. 14 | * Theme authors could potentially support multiple plugins. 15 | 16 | If plugin authors have some standards to go by, it'd make life so much easier for both developers and users. 17 | 18 | ## What this project is for 19 | 20 | First and foremost, the project is for establishing some standards for plugin authors to follow. 21 | 22 | A secondary goal might be for us to put together a few PHP scripts to copy/paste for quick registration of a post type or taxonomy. That way, there's even less confusion about how to register a post type or taxonomy following these standards. 23 | 24 | ## Some guidelines 25 | 26 | This is a jumping off point in how we should handle things. This is based off core WordPress' methods. 27 | 28 | ### Post types and taxonomies 29 | 30 | * Names should be all lowercase (e.g., `post`). 31 | * Names should be the singular English word (`page` rather than `pages`). 32 | * Names should contain only letters and underscores (e.g., `post_tag`). 33 | * Underscores should be used to separate words (e.g., `nav_menu_item`). 34 | 35 | ### Post metadata 36 | 37 | * Keys should be all lowercase. 38 | * Keys should begin with an underscore and post type with an exception for long post type names (e.g., `_recipe_servings`). 39 | 40 | ## Current Content Types 41 | 42 | See "Initial List" below. These will be listed here. 43 | 44 | ## To Do 45 | 46 | Before jumping too deep into the discussion, which is common with these types of things, we need to establish the foundation. Because the foundation of this project is custom post types, we should decide on a list of common post types we want to address first (more can be added later). 47 | 48 | ### Initial list 49 | 50 | * Testimonials 51 | * Portfolios 52 | * Recipes 53 | * FAQs 54 | * Events 55 | 56 | ### Secondary things to do 57 | 58 | Once we've established which post types we want to address, then we can address the naming standards, taxonomies, metadata, etc. 59 | 60 | ## References 61 | 62 | Here's a list of references that go into more detail about the issues this project is attempting to address: 63 | 64 | * [Custom Post Type Standards](http://justintadlock.com/archives/2014/07/25/custom-post-type-standards) 65 | * [WordPress.com and Jetpack should lead the way toward standardizing custom post types](http://www.poststat.us/wordpress-com-jetpack-lead-way-toward-standardizing-custom-post-types) -------------------------------------------------------------------------------- /portfolio/post-types.php: -------------------------------------------------------------------------------- 1 | '', 13 | 'public' => true, 14 | 'publicly_queryable' => true, 15 | 'show_in_nav_menus' => false, 16 | 'show_in_admin_bar' => true, 17 | 'exclude_from_search' => false, 18 | 'show_ui' => true, 19 | 'show_in_menu' => true, 20 | 'menu_position' => 12, 21 | 'menu_icon' => 'dashicons-portfolio', 22 | 'can_export' => true, 23 | 'delete_with_user' => false, 24 | 'hierarchical' => false, 25 | 'has_archive' => 'portfolio', 26 | 'query_var' => 'portfolio_project', 27 | 'capability_type' => 'portfolio_project', 28 | 'map_meta_cap' => true, 29 | 30 | /* Capabilities. */ 31 | 'capabilities' => array( 32 | 33 | // meta caps (don't assign these to roles) 34 | 'edit_post' => 'edit_portfolio_project', 35 | 'read_post' => 'read_portfolio_project', 36 | 'delete_post' => 'delete_portfolio_project', 37 | 38 | // primitive/meta caps 39 | 'create_posts' => 'create_portfolio_projects', 40 | 41 | // primitive caps used outside of map_meta_cap() 42 | 'edit_posts' => 'edit_portfolio_projects', 43 | 'edit_others_posts' => 'manage_portfolio', 44 | 'publish_posts' => 'manage_portfolio', 45 | 'read_private_posts' => 'read', 46 | 47 | // primitive caps used inside of map_meta_cap() 48 | 'read' => 'read', 49 | 'delete_posts' => 'manage_portfolio', 50 | 'delete_private_posts' => 'manage_portfolio', 51 | 'delete_published_posts' => 'manage_portfolio', 52 | 'delete_others_posts' => 'manage_portfolio', 53 | 'edit_private_posts' => 'edit_portfolio_projects', 54 | 'edit_published_posts' => 'edit_portfolio_projects' 55 | ), 56 | 57 | /* The rewrite handles the URL structure. */ 58 | 'rewrite' => array( 59 | 'slug' => 'portfolio', 60 | 'with_front' => false, 61 | 'pages' => true, 62 | 'feeds' => true, 63 | 'ep_mask' => EP_PERMALINK, 64 | ), 65 | 66 | /* What features the post type supports. */ 67 | 'supports' => array( 68 | 'title', 69 | 'editor', 70 | 'excerpt', 71 | 'author', 72 | 'thumbnail' 73 | ), 74 | 75 | /* Labels used when displaying the posts. */ 76 | 'labels' => array( 77 | 'name' => __( 'Projects', 'example-textdomain' ), 78 | 'singular_name' => __( 'Project', 'example-textdomain' ), 79 | 'menu_name' => __( 'Portfolio', 'example-textdomain' ), 80 | 'name_admin_bar' => __( 'Portfolio Project', 'example-textdomain' ), 81 | 'add_new' => __( 'Add New', 'example-textdomain' ), 82 | 'add_new_item' => __( 'Add New Project', 'example-textdomain' ), 83 | 'edit_item' => __( 'Edit Project', 'example-textdomain' ), 84 | 'new_item' => __( 'New Project', 'example-textdomain' ), 85 | 'view_item' => __( 'View Project', 'example-textdomain' ), 86 | 'search_items' => __( 'Search Projects', 'example-textdomain' ), 87 | 'not_found' => __( 'No projects found', 'example-textdomain' ), 88 | 'not_found_in_trash' => __( 'No projects found in trash', 'example-textdomain' ), 89 | 'all_items' => __( 'Projects', 'example-textdomain' ), 90 | ) 91 | ) 92 | ); 93 | } 94 | -------------------------------------------------------------------------------- /testimonials/post-types.php: -------------------------------------------------------------------------------- 1 | '', 13 | 'public' => true, 14 | 'publicly_queryable' => true, 15 | 'show_in_nav_menus' => false, 16 | 'show_in_admin_bar' => true, 17 | 'exclude_from_search' => false, 18 | 'show_ui' => true, 19 | 'show_in_menu' => true, 20 | 'menu_position' => null, 21 | 'menu_icon' => 'dashicons-testimonial', 22 | 'can_export' => true, 23 | 'delete_with_user' => false, 24 | 'hierarchical' => false, 25 | 'has_archive' => 'testimonials', 26 | 'query_var' => 'testimonial', 27 | 'capability_type' => 'testimonial', 28 | 'map_meta_cap' => true, 29 | 30 | /* Capabilities. */ 31 | 'capabilities' => array( 32 | 33 | // meta caps (don't assign these to roles) 34 | 'edit_post' => 'edit_testimonial', 35 | 'read_post' => 'read_testimonial', 36 | 'delete_post' => 'delete_testimonial', 37 | 38 | // primitive/meta caps 39 | 'create_posts' => 'create_testimonials', 40 | 41 | // primitive caps used outside of map_meta_cap() 42 | 'edit_posts' => 'edit_testimonials', 43 | 'edit_others_posts' => 'manage_testimonials', 44 | 'publish_posts' => 'manage_testimonials', 45 | 'read_private_posts' => 'read', 46 | 47 | // primitive caps used inside of map_meta_cap() 48 | 'read' => 'read', 49 | 'delete_posts' => 'manage_testimonials', 50 | 'delete_private_posts' => 'manage_testimonials', 51 | 'delete_published_posts' => 'manage_testimonials', 52 | 'delete_others_posts' => 'manage_testimonials', 53 | 'edit_private_posts' => 'edit_testimonials', 54 | 'edit_published_posts' => 'edit_testimonials' 55 | ), 56 | 57 | /* The rewrite handles the URL structure. */ 58 | 'rewrite' => array( 59 | 'slug' => 'testimonials', 60 | 'with_front' => false, 61 | 'pages' => true, 62 | 'feeds' => true, 63 | 'ep_mask' => EP_PERMALINK, 64 | ), 65 | 66 | /* What features the post type supports. */ 67 | 'supports' => array( 68 | 'title', 69 | 'editor', 70 | 'author', 71 | 'thumbnail' 72 | ), 73 | 74 | /* Labels used when displaying the posts. */ 75 | 'labels' => array( 76 | 'name' => __( 'Testimonials', 'example-textdomain' ), 77 | 'singular_name' => __( 'Testimonial', 'example-textdomain' ), 78 | 'menu_name' => __( 'Testimonials', 'example-textdomain' ), 79 | 'name_admin_bar' => __( 'Testimonial', 'example-textdomain' ), 80 | 'add_new' => __( 'Add New', 'example-textdomain' ), 81 | 'add_new_item' => __( 'Add New Testimonial', 'example-textdomain' ), 82 | 'edit_item' => __( 'Edit Testimonial', 'example-textdomain' ), 83 | 'new_item' => __( 'New Testimonial', 'example-textdomain' ), 84 | 'view_item' => __( 'View Testimonial', 'example-textdomain' ), 85 | 'search_items' => __( 'Search Testimonials', 'example-textdomain' ), 86 | 'not_found' => __( 'No testimonials found', 'example-textdomain' ), 87 | 'not_found_in_trash' => __( 'No testimonials found in trash', 'example-textdomain' ), 88 | 'all_items' => __( 'Testimonials', 'example-textdomain' ), 89 | ) 90 | ) 91 | ); 92 | } 93 | -------------------------------------------------------------------------------- /portfolio/taxonomies.php: -------------------------------------------------------------------------------- 1 | true, 14 | 'show_ui' => true, 15 | 'show_in_nav_menus' => true, 16 | 'show_tagcloud' => true, 17 | 'show_admin_column' => true, 18 | 'hierarchical' => true, 19 | 'query_var' => 'portfolio_category', 20 | 21 | /* Capabilities. */ 22 | 'capabilities' => array( 23 | 'manage_terms' => 'manage_portfolio', 24 | 'edit_terms' => 'manage_portfolio', 25 | 'delete_terms' => 'manage_portfolio', 26 | 'assign_terms' => 'edit_portfolio_projects', 27 | ), 28 | 29 | /* The rewrite handles the URL structure. */ 30 | 'rewrite' => array( 31 | 'slug' => 'portfolio/category', 32 | 'with_front' => false, 33 | 'hierarchical' => true, 34 | 'ep_mask' => EP_NONE 35 | ), 36 | 37 | /* Labels used when displaying taxonomy and terms. */ 38 | 'labels' => array( 39 | 'name' => __( 'Project Categories', 'example-textdomain' ), 40 | 'singular_name' => __( 'Project Category', 'example-textdomain' ), 41 | 'menu_name' => __( 'Categories', 'example-textdomain' ), 42 | 'name_admin_bar' => __( 'Category', 'example-textdomain' ), 43 | 'search_items' => __( 'Search Categories', 'example-textdomain' ), 44 | 'popular_items' => __( 'Popular Categories', 'example-textdomain' ), 45 | 'all_items' => __( 'All Categories', 'example-textdomain' ), 46 | 'edit_item' => __( 'Edit Category', 'example-textdomain' ), 47 | 'view_item' => __( 'View Category', 'example-textdomain' ), 48 | 'update_item' => __( 'Update Category', 'example-textdomain' ), 49 | 'add_new_item' => __( 'Add New Category', 'example-textdomain' ), 50 | 'new_item_name' => __( 'New Category Name', 'example-textdomain' ), 51 | 'parent_item' => __( 'Parent Category', 'example-textdomain' ), 52 | 'parent_item_colon' => __( 'Parent Category:', 'example-textdomain' ), 53 | 'separate_items_with_commas' => null, 54 | 'add_or_remove_items' => null, 55 | 'choose_from_most_used' => null, 56 | 'not_found' => null, 57 | ) 58 | ) 59 | ); 60 | 61 | /* Register the Portfolio Tag taxonomy. */ 62 | 63 | register_taxonomy( 64 | 'portfolio_tag', 65 | array( 'portfolio_project' ), 66 | array( 67 | 'public' => true, 68 | 'show_ui' => true, 69 | 'show_in_nav_menus' => true, 70 | 'show_tagcloud' => true, 71 | 'show_admin_column' => true, 72 | 'hierarchical' => false, 73 | 'query_var' => 'portfolio_tag', 74 | 75 | /* Capabilities. */ 76 | 'capabilities' => array( 77 | 'manage_terms' => 'manage_portfolio', 78 | 'edit_terms' => 'manage_portfolio', 79 | 'delete_terms' => 'manage_portfolio', 80 | 'assign_terms' => 'edit_portfolio_projects', 81 | ), 82 | 83 | /* The rewrite handles the URL structure. */ 84 | 'rewrite' => array( 85 | 'slug' => 'portfolio/tag', 86 | 'with_front' => false, 87 | 'hierarchical' => false, 88 | 'ep_mask' => EP_NONE 89 | ), 90 | 91 | /* Labels used when displaying taxonomy and terms. */ 92 | 'labels' => array( 93 | 'name' => __( 'Project Tags', 'example-textdomain' ), 94 | 'singular_name' => __( 'Project Tag', 'example-textdomain' ), 95 | 'menu_name' => __( 'Tags', 'example-textdomain' ), 96 | 'name_admin_bar' => __( 'Tag', 'example-textdomain' ), 97 | 'search_items' => __( 'Search Tags', 'example-textdomain' ), 98 | 'popular_items' => __( 'Popular Tags', 'example-textdomain' ), 99 | 'all_items' => __( 'All Tags', 'example-textdomain' ), 100 | 'edit_item' => __( 'Edit Tag', 'example-textdomain' ), 101 | 'view_item' => __( 'View Tag', 'example-textdomain' ), 102 | 'update_item' => __( 'Update Tag', 'example-textdomain' ), 103 | 'add_new_item' => __( 'Add New Tag', 'example-textdomain' ), 104 | 'new_item_name' => __( 'New Tag Name', 'example-textdomain' ), 105 | 'separate_items_with_commas' => __( 'Separate tags with commas', 'example-textdomain' ), 106 | 'add_or_remove_items' => __( 'Add or remove tags', 'example-textdomain' ), 107 | 'choose_from_most_used' => __( 'Choose from the most used tags', 'example-textdomain' ), 108 | 'not_found' => __( 'No tags found', 'example-textdomain' ), 109 | 'parent_item' => null, 110 | 'parent_item_colon' => null, 111 | ) 112 | ) 113 | ); 114 | } 115 | --------------------------------------------------------------------------------