- Importing Starter Templates With Spectra
- Filters/Actions For Post
- Spectra Patterns
- Contact Form 7: Checkbox / Radio / Acceptance Control
- Getting Started With Spectra
- WP – Search
- Create Contact Forms
- Import Single Pages, Templates, & Block Patterns
- Assets API For Third-Party Plugins
- Copy & Paste Style
- Coming Soon Mode
- Load Google Fonts Locally
- Blocks Editor Spacing
- Translate Everything WPML
- Collapse Panels
- Site Visibility
- Spectra Actions: Clear Cache
- Quick Action Bar
- Custom Blocks
- Move Block Patterns
- Move Title Bar To Top
- Newsletter Forms
- Register High-Privileged Users
- User Roles Access To AI
- Whitelist Email Address
- Hide Core Blocks
- Regenerate Assets With Code
- Using ACF Repeater Field in Spectra
- How to Fix Stretched Spectra Images in WordPress 6.7
- How to Change Breakpoints in Spectra?
- Controlling Access to the Spectra Design Library Based on User Roles
- Multi-Column Form Block Using Utility Classes
- Preview Options (Desktop, Tablet & Mobile)
- Troubleshooting: Missing Icons
- Contact Form 7: Multiple Column Fields
- Unable To Style Contact Form 7
- Tab Index For Multiple Gravity Forms
- Manually Install Spectra Via FTP
- Enable/Disable Design Library Button
- Update Folder File Permissions
- Resolving Container Layout Conflicts
- Database Update Instructions (Below 2.0.0)
- 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.