Skip to content

Instantly share code, notes, and snippets.

@bacoords
Created April 17, 2024 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bacoords/0d3d9a40bb8fad67e756fa004fc99e0e to your computer and use it in GitHub Desktop.
Save bacoords/0d3d9a40bb8fad67e756fa004fc99e0e to your computer and use it in GitHub Desktop.
example enqueue
<?php
/**
* Enqueue block editor assets.
*
* @return void
*/
function enqueue_custom_block_editor_modifications() {
$asset_file = include PLUGIN_PATH . '/build/editor-modifications/index.asset.php';
wp_enqueue_script(
'plugin-editor-modifications',
PLUGIN_URL . '/build/editor-modifications/index.js',
$asset_file['dependencies'],
$asset_file['version'],
true
);
wp_enqueue_style(
'plugin-editor-modifications',
PLUGIN_URL . '/build/editor-modifications/index.css',
array(),
$asset_file['version']
);
}
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_custom_block_editor_modifications' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment