Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (46 sloc) 1.97 KB
<?php
/**
* Enqueue Gutenberg block assets for both frontend + backend.
*
* `wp-blocks`: includes block type registration and related functions.
*
* @since 1.0.0
*/
function guten_post_list_cgb_block_assets() {
// Styles.
wp_enqueue_style(
'guten_post_list-cgb-style-css', // Handle.
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
array( 'wp-blocks' ) // Dependency to include the CSS after it.
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime — Gets file modification time.
);
} // End function guten_post_list_cgb_block_assets().
// Hook: Frontend assets.
add_action( 'enqueue_block_assets', 'guten_post_list_cgb_block_assets' );
/**
* Enqueue Gutenberg block assets for backend editor.
*
* `wp-blocks`: includes block type registration and related functions.
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
* `wp-i18n`: To internationalize the block's text.
*
* @since 1.0.0
*/
function guten_post_list_cgb_editor_assets() {
// Scripts.
wp_enqueue_script(
'guten_post_list-cgb-block-js', // Handle.
plugins_url( '/dist/blocks.build.js', dirname( __DIR__ ) ), // Block.build.js: We register the block here. Built with Webpack.
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
// filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ) // Version: filemtime — Gets file modification time.
);
// Styles.
wp_enqueue_style(
'guten_post_list-cgb-block-editor-css', // Handle.
plugins_url( 'dist/blocks.editor.build.css', dirname( __DIR__ ) ), // Block editor CSS.
array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime — Gets file modification time.
);
} // End function guten_post_list_cgb_editor_assets().
// Hook: Editor assets.
add_action( 'enqueue_block_editor_assets', 'guten_post_list_cgb_editor_assets' );