Skip to content

marcosnunesmbs/wpcreator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Latest Stable Version License

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

  1. 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"
          }
        ]
      }
    ]
  }
  

For more examples

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
  1. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •