Kadence Blocks
repository·master·Indexed 43 days ago
https://github.com/stellarwp/kadence-blocksA page builder toolkit for the WordPress Gutenberg editor providing over 20 custom blocks for high-performance, responsive layouts. Includes a Performance Optimizer to improve Core Web Vitals (LCP, CLS, INP) via client-side analysis and server-side resource optimization, as well as a REST API for managing optimization data.
What's inside Kadence Blocks
- Kadence Blocks is a page builder toolkit for the WordPress Gutenberg editor. It provides over 20 custom blocks designed for high performance, accessibility, and design flexibility. It allows users to build complex, responsive layouts directly within the native WordPress editor without writing code.
Key Features of Kadence Blocks
masterKadence Blocks is built around several core functional pillars:
- Intelligent Load: Only loads necessary CSS or JavaScript for the specific blocks used on a page to maintain performance.
- Responsive Controls: Allows tweaking design settings (padding, margins, typography) specifically for desktop, tablet, and mobile views.
- Design Library: Provides hundreds of pre-built patterns and pages to accelerate site assembly.
- Typography & Color: Access to 900+ Google fonts, gradients, overlays, and parallax backgrounds.
- Configurable Defaults: Define default settings for blocks to ensure consistency across a site.
- Setting Visibility Controls: Ability to hide specific block settings from certain user roles.
Available Custom Blocks
masterKadence Blocks includes a variety of specialized blocks for layout and content:
- Accordion: Customizable panels that can contain other blocks.
- Advanced Button: Single or multiple buttons with hover controls and icon support.
- Advanced Form: Contact and marketing forms with styling controls.
- Advanced Gallery: Photo galleries, carousels, and sliders.
- Advanced Text: Headings and paragraphs with responsive typography and Inline AI editing.
- Countdown: Urgency-inducing timers (Pro includes evergreen campaigns).
- Count Up: Animated number counters.
- Info Box: Content boxes with icons/images, titles, and descriptions.
- Icon: Access to 1500+ SVG icons.
- Icon List: Engaging lists with icon support.
- Lottie Animation: Support for importing and controlling Lottie animations.
- Posts: Grid displays for blog posts.
- Progress Bar: Visual goal/satisfaction indicators.
- Row Layout: Container for nested blocks in columns.
- Section: Designable content areas within Row Layouts.
- Show More: Content previews with adjustable sizes and fade-outs.
- Spacer / Divider: Control spacing and dividers with per-device height settings.
- Table of Contents: Automatic anchor links and smooth scrolling for headings.
- Tabs: Vertical or horizontal tab layouts.
- Testimonials: Carousel or grid displays for social proof.
How the Kadence Performance Optimizer works
masterThe Optimizer improves Core Web Vitals (LCP, CLS, INP) using a two-phase process:
- Analysis Phase (Client-side): When optimization is triggered in
wp-admin, JavaScript (via@stellarwp/perf-analyzer-client) analyzes the page to detect critical images, section heights, and optimal image sizes for desktop and mobile viewports. - Application Phase (Server-side): On subsequent requests, the stored analysis data is used to apply optimizations such as proper lazy loading,
content-visibility: autofor below-the-fold sections, and optimal imagesizesattributes.
Hash-Based Invalidation: To ensure optimizations remain accurate, the system compares HTML hashes on each request. If the HTML hash differs from the stored hash for a specific viewport, the data is marked
isStale = trueand re-optimization is required.- Analysis Phase (Client-side): When optimization is triggered in
Trigger hash storage for desktop or mobile
masterYou can manually trigger the storage of HTML hashes for specific viewports by appending query parameters to the URL. This is useful for forcing a re-analysis of the page content.
?kadence_set_optimizer_hash=1 # Desktop hash ?kadence_set_optimizer_hash=1&kadence_is_mobile=1 # Mobile hashEnable the Kadence Performance Optimizer
masterThe Optimizer can be enabled globally through the Gutenberg editor interface:
- Open a post or page in the block editor.
- Click the Kadence "K" icon in the top toolbar to open Kadence Blocks Controls.
- Expand the Performance Optimizer panel.
- Toggle "Globally Enable The Performance Optimizer".
This setting is stored in the
kadence_blocks_settingsoption under the keyperformance_optimizer_enabled.Install Kadence Blocks
masterTo install Kadence Blocks, download the plugin and place it into your WordPress site's/wp-content/plugins/directory, then activate it through the WordPress admin dashboard.Upgrade to Kadence Blocks Pro
masterUpgrading to the Pro version unlocks advanced features including:
- Advanced Blocks: Advanced Query Loop, Advanced Slider, Image Overlay, Modal, Post Grid/Carousel, Product Carousel, Repeater, and Split Content.
- Premium Functionality: Animate on Scroll, Custom Icons, Custom Fonts, Dynamic Content (integrating with ACF, MetaBox, WooCommerce, etc.), and Page Specific Scripts.
- Expanded Design Library: Access to over 800+ additional patterns.
Understand the kadenceHomeParams configuration object
masterThe
KadenceBlocksHomecomponent consumes a global configuration object namedkadenceHomeParams(attached to thewindowobject). This object controls the dashboard's logic and visibility.Available Properties
isAuthorized: Boolean indicating if the user is authenticated for AI features.isNetworkAdmin: Boolean indicating if the user has network-level administrative privileges.isNetworkEnabled: Boolean indicating if the network features are enabled.pro: String'true'or other values indicating if the user has a Pro license.homeContent: An object containing configuration foractionCardsandknowledgeBase.disconnectUrl: The URL used to revoke AI access.
Logic for
showControlsControls are shown if:
- The user is a Network Admin AND the network is enabled.
- OR, the user is NOT a Network Admin AND the network is NOT enabled.
Debug the Kadence Performance Optimizer
masterTo troubleshoot the Optimizer, use the following methods:
Enable Debug Logging
Set
WP_DEBUGtotruein yourwp-config.php. Logs are prefixed with[Kadence Blocks]:and written to the PHP error log.define( 'WP_DEBUG', true );Verify Optimization Status
- Visual Check: Look for the
kb-optimizedclass on the<body>tag. - Preview Mode: Add
?kadence_optimizer_preview=1to any URL to view the optimized version, bypassing skip rules (like logged-in user restrictions).
Programmatic Access
You can retrieve stored analysis data via the
Storecontainer:$store = KadenceWP//... (truncated for brevity) $path = new \KadenceWP\KadenceBlocks\Optimizer\Path\Path( '/my-page/', $post_id ); $analysis = $store->get( $path );- Visual Check: Look for the
Add custom ignored query variables to Skip Rules
masterThe
Ignored_Query_Var_Ruleskips optimization when specific query parameters are present. You can add your own custom query variables to this list using thekadence_blocks_optimizer_rule_skip_query_varsfilter.add_filter( 'kadence_blocks_optimizer_rule_skip_query_vars', static fn( array $vars ): array => [ ...$vars, 'my_custom_preview', ]);Exclude sections from Section Lazy Loading
masterThe Optimizer applies
content-visibility: autoto below-the-fold Kadence Row and Column blocks. If a section causes layout shifts (CLS) or requires immediate rendering (like parallax sections), you can exclude it using thekadence_blocks_optimizer_section_lazy_load_excluded_classesfilter.// Exclude specific classes from section lazy loading. add_filter( 'kadence_blocks_optimizer_section_lazy_load_excluded_classes', static fn( array $classes ): array => [ ...$classes, 'my-parallax-section', ]);