A simple php cli to create Wordpress Custom Post Types, Elementor's Widgets and another utilityes by yaml files.
This CLI application is a Wordpress Custom Post Type Builder written in PHP and is installed using Composer:
composer global require marcosnunesmbs/wpcreator
- Create a file example.yaml or example.json with basic informations:
name: Cars
labels:
plural: Cars
singular: Car
menuName: Cars
slug: cars
supports: title thumbnail
taxonomies:
- name: Manufacturer
singular: Manufacturer
plural: Manufacturers
slug: manufacturer
hierarchical: 'true'
metaboxes:
- name: form_car
title: Form
postmetas:
- id: model_car
label: Model
type: text
- id: old_car
label: Old
type: text
- name: form2
title: Form 2
postmetas:
- id: purchase_date
label: Purchase Date
type: date
{
"name": "Cars",
"labels": {
"plural": "Cars",
"singular": "Car",
"menuName": "Cars"
},
"slug": "car",
"supports": "title thumbnail",
"taxonomies": [
{
"name": "Manufacturer",
"singular": "Manufacturer",
"plural": "Manufacturers",
"slug": "manufacturer",
"hierarchical": "true"
}
],
"metaboxes": [
{
"name": "form_car",
"title": "Form",
"postmetas": [
{
"id": "model_car",
"label": "Model",
"type": "text"
},
{
"id": "old_car",
"label": "Old",
"type": "text"
}
]
},
{
"name": "form2",
"title": "Form 2",
"postmetas": [
{
"id": "purchase_date",
"label": "Purchase Date",
"type": "date"
}
]
}
]
}
Parameter | Description |
---|---|
name | The name of CPT and File |
plural | The plural name of CPT |
singular | The singular name of CPT |
menuName | The Menu name of CPT |
slug | The slug name of CPT |
supports | The list of supports separetade by spaces. See more arguments on documentation. |
taxonomies | array of taxonomies |
name | Taxonomy Name (Singular) |
title | Title of taxonomie |
postmetas | Array of postmetas |
id | Postmeta id |
label | Postmeta label |
type | Type of postmeta input |
- Execute the command create:cpt folowing the yaml path:
wpcreator create:cpt example.yaml
This command will create a folder named "output" with the file Cars.php which the basic Custom Post Type configuration customized.