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 post-anonymously-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 define_public_hooks
method of your plugin
-
Now run
composer require wpboilerplate/wpb-register-blocks
-
Now run
composer update
-
Once that is installed run
npm run build
- 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( POST_ANONYMOUSLY_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(), POST_ANONYMOUSLY_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