-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from sarahcssiqueira/develop
refactor: code cleanup, reorganized and linted using wpcs
- Loading branch information
Showing
4 changed files
with
119 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,60 @@ | ||
<?php | ||
/** | ||
* Block X | ||
* | ||
* @package xywzblocks | ||
*/ | ||
<?php | ||
/** | ||
* Block X | ||
* | ||
* @package xywzblocks | ||
*/ | ||
|
||
namespace XYWZBlocks\Inc; | ||
|
||
/** | ||
* Block X | ||
*/ | ||
class Block_X { | ||
|
||
|
||
/** | ||
* Constructor for handle WordPress Hooks | ||
*/ | ||
public function __construct() { | ||
add_action( 'init', [ $this, 'block_x_register' ] ); | ||
add_action( 'enqueue_block_editor_assets', [ $this, 'block_x_enqueues' ] ); | ||
add_filter( 'block_categories_all', [ $this, 'register_new_category' ], 10, 2 ); | ||
} | ||
|
||
/** | ||
* Register Block | ||
*/ | ||
public function block_x_register() { | ||
register_block_type( __DIR__ ); | ||
} | ||
|
||
/** | ||
* Enqueues | ||
*/ | ||
public function block_x_enqueues() { | ||
wp_enqueue_script( | ||
'block-x', | ||
plugin_dir_url( __FILE__ ) . './blocks/block-x/build/index.js', | ||
[ 'wp-blocks', 'wp-i18n', 'wp-editor' ] | ||
); | ||
|
||
wp_enqueue_style( | ||
'block-x', | ||
plugin_dir_url( __FILE__ ) . '.style/style.css', | ||
[], | ||
); | ||
} | ||
|
||
/** | ||
* Register custom category | ||
*/ | ||
public function register_new_category( $categories ) { | ||
$categories[] = [ | ||
'slug' => 'xywz-blocks', | ||
'title' => 'XYW...Z Blocks', | ||
]; | ||
|
||
return $categories; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Block Y | ||
* | ||
* @package xywzblocks | ||
*/ | ||
|
||
namespace XYWZBlocks\Inc; | ||
|
||
/** | ||
* Block Y | ||
*/ | ||
class Block_Y { | ||
|
||
|
||
/** | ||
* Constructor for handle WordPress Hooks | ||
*/ | ||
public function __construct() { | ||
add_action( 'init', [ $this, 'block_y_register' ] ); | ||
add_action( 'enqueue_block_editor_assets', [ $this, 'block_y_enqueues' ] ); | ||
} | ||
|
||
/** | ||
* Register Block | ||
*/ | ||
public function block_y_register() { | ||
register_block_type( __DIR__ ); | ||
} | ||
|
||
/** | ||
* Enqueues | ||
*/ | ||
public function block_y_enqueues() { | ||
wp_enqueue_script( | ||
'block-y', | ||
plugin_dir_url( __FILE__ ) . './blocks/block-y/build/index.js', | ||
[ 'wp-blocks', 'wp-i18n', 'wp-editor' ] | ||
); | ||
|
||
wp_enqueue_style( | ||
'block-y', | ||
plugin_dir_url( __FILE__ ) . '.style/style.css', | ||
[], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php // Silence is golden. | ||
<?php // Silence is golden. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters