mehrshaddarzi / wp-cli-trait-command
WP-CLI Trait Package Command.
Installs: 32
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 1
Type:wp-cli-package
Requires
- php: ^5.6 || ^7.0 || ^8.0
- ext-json: *
- wp-packagist/wp-cli-helper: >=1.0.2
Requires (Dev)
- phpunit/phpunit: ^4.8
- wp-cli/wp-cli: ^2.0
This package is auto-updated.
Last update: 2025-03-05 18:10:08 UTC
README
Generate plugin or php model files e.g. post-type or taxonomy for WP-Trait Package in Develop WordPress Plugin.
Installation
You can install this package with:
wp package install mehrshaddarzi/wp-cli-trait-command
Installing this package requires WP-CLI v2 or greater. Update to the latest stable release with
wp cli update
.
Structure
NAME
wp trait
DESCRIPTION
WP-CLI Trait Package Command.
SYNOPSIS
wp trait <command>
SUBCOMMANDS
add Add Custom Package.
make Generate Model Files.
remove Remove Custom Package.
start Generates starter code for a plugin
Generate Plugin
Use This Command:
wp trait start
And fill Your Plugin information e.g. slug and namespace:
1/12 [--slug=<slug>]: wp-plugin
2/12 [--namespace=<namespace>]: WP_Plugin
3/12 [--plugin_name=<title>]: plugin-name
4/12 [--plugin_description=<description>]: your plugin description
5/12 [--plugin_author=<author>]: Mehrshad Darzi
6/12 [--plugin_author_uri=<url>]: https://profiles.wordpress.org/mehrshaddarzi/
7/12 [--plugin_uri=<url>]: https://github.com/mehrshaddarzi/wp-trait
8/12 [--skip-tests] (Y/n): n
9/12 [--ci=<provider>]: travis
10/12 [--activate] (Y/n): y
11/12 [--activate-network] (Y/n): n
12/12 [--force] (Y/n): y
Make PHP Model
Create php model:
wp trait make model <class>
Notice: To execute the command to create a model or post-type, you must change the directory of your terminal address from the WordPress root to the plugin folder. for example first run
cd wp-content/plugins/my-plugin
command and then runwp trait make
Create Model With Class Name:
wp trait make model Option
Create Model With Nested Namespace:
wp trait make model User/Register
Create Model With Custom global Variable in Plugin:
wp trait make model User/Signup --var=register
Make WordPress Post Type
Make a new post-type in WordPress:
wp trait make post-type <class> <slug> <singular-name>
Create A new Post Type With City
slug:
wp trait make post-type City
After created You can change register_post_type
argument in main plugin files.
Create a new Post Type With Nested NameSpace:
wp trait make post-type Post/Orders order
Make WordPress Taxonomy
Make a new taxonomy in WordPress:
wp trait make taxonomy <class> <slug> <singular-name>
Create A new Taxonomy With Country
slug:
wp trait make taxonomy Country
After create You can change register_taxonomy argument in main plugin files.
Create a new Taxonomy With Nested NameSpace and Custom name:
wp trait make taxonomy Media/Category media_cat Category
Add or Remove Package
wp trait add <package>
wp trait remove <package>
List Of Trait Package
package | description |
---|---|
ide-helper | Create WP-Trait method helper for developer in IDE software e.g. PHPStorm |
cmb2 | Add CMB2 Framework to your plugin |
Author
- Mehrshad Darzi | PHP Full Stack and WordPress Expert
Contributing
We appreciate you taking the initiative to contribute to this project.
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
Reporting a bug
Think you’ve found a bug? We’d love for you to help us get it fixed. Before you create a new issue, you should search existing issues to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
Creating a pull request
Want to contribute a new feature? Please first open a new issue to discuss whether the feature is a good fit for the project.
Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:
- Create a feature branch for each contribution.
- Submit your pull request early for feedback.
- Follow PSR-2 Coding Standards.