A modern WordPress plugin boilerplate generator that creates a well-structured, object-oriented plugin with optional support for Elementor, WooCommerce, and Gutenberg blocks.
- 🏗️ Modern Object-Oriented Architecture
- 🧩 PSR-4 Autoloading
- 🔌 Optional Integration Support:
- Elementor Extensions
- WooCommerce Extensions
- Gutenberg Blocks
- 🛠️ Development Tools:
- Webpack configuration
- ESLint and Prettier setup
- SASS/SCSS support
- Hot Module Replacement (HMR)
- 🧪 Testing Setup
- 🌐 Internationalization Ready
- PHP 7.4 or higher
- WordPress 5.8 or higher
- Composer
- Node.js and npm (for Gutenberg development)
- Clone this repository:
git clone https://github.com/cmatosbc/wp-plugin-bash-generator.git
- Make the script executable:
chmod +x create.sh
Create a basic plugin with the standard structure:
./create.sh "Your Plugin Name"
Create a plugin with Elementor integration:
./create.sh "Your Plugin Name" --elementor
This will create:
- Custom Elementor widgets structure
- Widget registration system
- Category registration
Create a plugin with WooCommerce integration:
./create.sh "Your Plugin Name" --woocommerce
This will create:
- WooCommerce hooks integration
- Settings page
- Product-related functionality
Create a plugin with Gutenberg blocks support:
./create.sh "Your Plugin Name" --gutenberg
This will set up:
- Modern block development environment
- Example blocks (static and dynamic)
- Block patterns
- Block extensions
- Full Site Editing (FSE) templates
You can combine any of the features:
./create.sh "Your Plugin Name" --elementor --woocommerce --gutenberg
- Install PHP dependencies:
composer install
- If using Gutenberg blocks, install JavaScript dependencies:
npm install
- Run PHP tests:
composer test
- Check coding standards:
composer phpcs
- Fix coding standards:
composer phpcbf
- Start development server:
npm start
- Build for production:
npm run build
- Lint JavaScript:
npm run lint:js
- Lint CSS/SCSS:
npm run lint:style
- Format code:
npm run format
your-plugin/
├── assets/ # Compiled assets
│ ├── css/
│ ├── js/
│ └── images/
├── inc/ # PHP classes
│ ├── Admin/ # Admin-related classes
│ ├── Api/ # REST API endpoints
│ ├── Blocks/ # Gutenberg blocks (if enabled)
│ ├── Common/ # Shared traits and interfaces
│ ├── Core/ # Core plugin classes
│ ├── Elementor/ # Elementor integration (if enabled)
│ ├── Frontend/ # Frontend-related classes
│ └── WooCommerce/ # WooCommerce integration (if enabled)
├── languages/ # Translation files
├── src/ # Source files
│ ├── blocks/ # Gutenberg blocks source
│ ├── patterns/ # Block patterns
│ ├── templates/ # FSE templates
│ └── extensions/ # Block extensions
├── templates/ # Template files
├── tests/ # Test files
├── vendor/ # Composer dependencies
├── node_modules/ # npm dependencies
├── composer.json # PHP dependencies
├── package.json # JavaScript dependencies
├── webpack.config.js # Webpack configuration
├── README.md # This file
└── your-plugin.php # Main plugin file
- Always use namespaces for your classes
- Follow WordPress coding standards
- Write unit tests for your functionality
- Keep your code modular and maintainable
- Use hooks and filters to make your plugin extensible
- Document your code thoroughly
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Created and maintained by Carlos Matos.