Posttypes Json
Defines Custom Post Types (CPTs) without writing PHP.
{
"version": "1.0.0",
"posttypes": {
"project": {
"labels": {
"singular": "Project",
"plural": "Projects"
},
"supports": ["title", "editor", "thumbnail"],
"menu_icon": "dashicons-hammer",
"rewrite": { "slug": "projects" },
"taxonomies": ["sector"],
"archive": true,
"show_in_rest": true
},
"job": {
"labels": { "singular": "Job", "plural": "Jobs" },
"supports": ["title"],
"public": false, // still queryable via REST
"show_in_rest": true
}
}
}
Path
Description
version
Bumps the cache + flushes rewrite rules.
posttypes.{slug}.labels
singular
& plural
names. If omitted PorterWP auto‑titles.
posttypes.{slug}.supports
Array passed to register_post_type( … supports )
.
menu_icon
Dashicons class or SVG path. If SVG, gulpfile.js auto‑minifies into porter/inc/posttypes/{slug}/icon.svg
.
archive
true
for /slug/
archive, or string for custom. Leaving it out disables archives.
rewrite.slug
Override permalink base.
taxonomies
Array of taxonomy slugs to attach.
show_in_rest
Must be true
for Gutenberg/REST.
When you save the file the Gulp task
createPostTypes
auto‑creates the folder & SVG icon so nothing breaks in the admin menu.
Last updated