https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/
Now are using the https://github.com/x3p0-dev/x3p0-ideas/tree/block-example exmaple to setup out plugins
- Run
npm install
command and it will generate folder and files - Now run
npm run build
command and it will generate plugin build - Now run
npm run start
command and it will generate plugin on every file update
-
Once everything install goto
src/
folder and runnpx @wordpress/create-block wordpress-plugin-boilerplate-block --no-plugin
-
Now run
composer require wpboilerplate/wpb-register-blocks
-
Now add
/**
* Check if class exists or not
*/
if ( class_exists( 'WPBoilerplate_Register_Blocks' ) ) {
new WPBoilerplate_Register_Blocks( $this->plugin_dir );
}
inside the load_composer_dependencies
method at the end
-
Now run
composer require wpboilerplate/wpb-register-blocks
-
Now run
composer update
-
Once that is installed run
npm run build
-
run
composer require wpboilerplate/wpb-updater-checker-github
-
Now run
composer update
-
Now add
/**
* Check if class exists or not
*/
/**
* For Plugin Update via Github
*/
if ( class_exists( 'WPBoilerplate_Updater_Checker_Github' ) ) {
$package = array(
'repo' => 'https://github.com/WPBoilerplate/wordpress-plugin-boilerplate',
'file_path' => WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_FILE,
'plugin_name_slug' => WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_NAME_SLUG,
'release_branch' => 'main'
);
new WPBoilerplate_Updater_Checker_Github( $package );
}
inside the load_composer_dependencies
method at the end
- Adding BuddyBoss Platform and Platform Pro dependency
composer require wpboilerplate/wpb-buddypress-or-buddyboss-dependency
and then add the below code in function load_dependencies after vendor autoload file includedrequire_once( WORDPRESS_PLUGIN_BOILERPLATE_PLUGIN_PATH . 'vendor/autoload.php' );
/**
* Add the dependency for the call
*/
if ( class_exists( 'WPBoilerplate_BuddyPress_BuddyBoss_Platform_Dependency' ) ) {
new WPBoilerplate_BuddyPress_BuddyBoss_Platform_Dependency( $this->get_plugin_name(), WORDPRESS_PLUGIN_BOILERPLATE_FILES );
}
-
Adding BuddyBoss Platform dependency
composer require wpboilerplate/wpb-buddyboss-dependency
-
Adding WooCommerce dependency
composer require wpboilerplate/wpb-woocommerce-dependency
-
Adding ACF Pro dependency
composer require wpboilerplate/acrossswp-acf-pro-dependency
-
Adding View Analytics dependency
composer require wpboilerplate/wpb-view-analytics-dependency