3, 'supports' => array( 'align' => true, 'alignWide' => true ), 'editor_script' => 'mobile_api-vehicle-archive-block-script', 'style' => 'mobile_api-vehicle-archive-block-style', 'render_callback' => 'mobile_api_shortcode_vehicle_archive', 'attributes' => array( 'category' => array( 'type' => 'array', 'default' => array() ) ) ) ); } add_action( 'init', 'mobile_api_vehicle_archive_block' ); /* if ( function_exists( 'register_block_type' ) ) new Mobile_API_Vehicle_Archive_Block(); class Mobile_API_Vehicle_Archive_Block { public function __construct() { add_action( 'init', [ $this, 'gutenberg_block_register_block' ] ); add_action( 'enqueue_block_editor_assets', [ $this, 'gutenberg_block_editor_scripts' ] ); } public function gutenberg_block_register_block() { register_block_type( 'mobile-api/vehicle-archive', [ 'editor_script' => 'mobile_api-vehicle-archive-block-script', 'editor_style' => 'mobile_api-vehicle-archive-block-editor-style', 'style' => 'mobile_api-vehicle-archive-block-style', 'render_callback' => [ $this, 'mobile_api_shortcode_vehicle_archive' ], 'attributes' => [ 'category' => [ 'type' => 'array' ], 'design' => [ 'type' => 'string', 'default' => 'default' ] ] ] ); } public function gutenberg_block_editor_scripts() { wp_enqueue_script( 'mobile_api-vehicle-archive-block-script', plugins_url( 'block.js', __FILE__ ), array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-editor' ), filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ), true ); wp_register_style( 'mobile_api-vehicle-archive-block-editor-style', plugins_url( 'editor.css', __FILE__ ), array( 'wp-edit-blocks' ), filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) ); wp_register_style( 'mobile_api-vehicle-archive-block-style', plugins_url( 'style.css', __FILE__ ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'style.css' ) ); } } */