marcosnunesmbs / wpcreator
A Wordpress CPT builder
1.1.1
2023-08-06 15:05 UTC
Requires
- php: ^8.0
- symfony/console: ^5.0|^6.0
- symfony/yaml: ^5.4
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2024-04-11 23:30:22 UTC
README
Description
A simple php cli to create Wordpress Custom Post Types, Elementor's Widgets and another utilityes by yaml files.
Getting Started
Install
This CLI application is a Wordpress Custom Post Type Builder written in PHP and is installed using Composer:
composer global require marcosnunesmbs/wpcreator
Usage
Creating a Custom Post Type
- 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.