Generate plugin or php model files e.g. post-type or taxonomy for WP-Trait Package in Develop WordPress Plugin.
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
.
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
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
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
wp trait make model Option
wp trait make model User/Register
wp trait make model User/Signup --var=register
Make a new post-type in WordPress:
wp trait make post-type <class> <slug> <singular-name>
wp trait make post-type City
After created You can change register_post_type
argument in main plugin files.
wp trait make post-type Post/Orders order
Make a new taxonomy in WordPress:
wp trait make taxonomy <class> <slug> <singular-name>
wp trait make taxonomy Country
After create You can change register_taxonomy argument in main plugin files.
wp trait make taxonomy Media/Category media_cat Category
wp trait add <package>
wp trait remove <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 |
- Mehrshad Darzi | PHP Full Stack and WordPress Expert
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.
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.
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.