Introducing the API to enqueue Ultimate Addons for Gutenberg (UAG) assets for third-party developers.
Now, You can load UAG blocks’ assets anywhere using an instance of our class. For this, you need to use the post ID of the page where you have used blocks.
Here is how you can do this –
- Create an instance of our UAGB_Post_Assets class by passing argument a post ID of a page for which you need to load assets.
- After creating the instance, call a function of the instance.
All the assets related to UAG blocks will enqueued on the above page.
Here is an example –
add_action( 'wp_enqueue_scripts', 'enqueue_scripts_by_post_id' );
function enqueue_scripts_by_post_id() {
// Create Instance. Pass the Post ID.
$post_assets_instance = new UAGB_Post_Assets( $post_id );
// Enqueue the Assets.
$post_assets_instance->enqueue_scripts();
}