- Section
- Troubleshooting: Missing Icons
- Spectra Patterns
- Contact Form 7: Multiple Column Fields
- Contact Form 7: Checkbox / Radio / Acceptance Control
- Unable To Style Contact Form 7
- Tab Index For Multiple Gravity Forms
- Getting Started With Spectra
- Exclude Heading From TOC
- Block Display Conditions
- Transparent / Sticky Header
- Change Site Logo
- Change Global Styles
- Disable Title on Posts & Pages
- Transparent / Sticky Header For Single Page / Post
- Change Header & Footer Patterns
- Custom / Google Fonts
- Reset Global Default Styling
- Manually Install Spectra One Via FTP
- Enable / Disable Header & Footer On Specific Pages / Posts
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