/ Documentation /Developer/Assets API for Third-Party Plugins

Assets API for Third-Party Plugins

Introducing the API to enqueue Spectra assets for third-party developers.

Now, You can load Spectra 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 Spectra blocks will be 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();
}
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page
Build Ultra High Performance
Websites, Without Coding

Whether you are a beginner, marketer, or professional, Spectra has the tools and resources you can rely on to succeed

Get Notified When Available

Note - You can purchase the Essential Toolkit now and easily upgrade to the Business Toolkit once it becomes available.

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Get your hands on Spectra Pro

Enter your name and email address to get access to Spectra Pro.