Repository navigation
Keep widget classes on non-TG widgets rendered in Elementor - #93
Conversation
The Elementor widget-args filter builds the wrapper as
<aside class="widget {classes}">, but the class lookup only knows the
theme's own widgets and returned an empty string for everything else. Core
and WooCommerce widgets therefore rendered as <aside class="widget "> and
lost selectors like widget_shopping_cart that their CSS depends on. For
widgets outside the theme's list the class is now read from the registered
widget (its classname option), and the value is escaped. The theme's own
widgets are unchanged.
Verified live on an Elementor page: the Cart widget wrapper went from
"widget " to "widget woocommerce widget_shopping_cart", and the mini-cart
item padding, remove-link position and thumbnail width went from 0 / static
/ 300px to 32px / absolute / 32px.
QA suite — refused, no regression specThis PR changes product source but adds no spec, so the suite was Source files changed with no matching spec |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review comments; the focused fix preserves existing behavior while restoring widget styling.
Review effort: Lite
Findings: None
What changed in this PR
Fixes missing CSS classes on core and WooCommerce widgets rendered through Elementor.
Changes:
- Falls back to registered widget
classnamevalues. - Escapes resolved widget classes.
- Preserves existing theme widget mappings.
| File | Summary |
|---|---|
inc/elementor/elementor.php |
Adds fallback class resolution and output escaping. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@deepench The Elementor classes fix works, but Search, Categories and other titled core widgets now show a box (□) before the title. Why: the title icon rules now match, but the Font Awesome font is only set for
Same issue on accelerate-pro#124. Screenshots are on the |
The title icon rules now match Elementor-rendered widgets, but the font-family and the primary color override only targeted #secondary and the footer, so the icons showed as missing-glyph boxes and ignored a custom primary color.
Verified live: both scenarios pass 3/3 on the fixed code; the class scenario fails on the parent commit (wrapper is "widget " with no widget_search) and the icon scenario fails without the font rule (font-family is Roboto Slab).


Free-theme counterpart of themegrill/accelerate-pro#63 (the same filter and helper are in the free theme).
Changes proposed in this Pull Request:
Core and WooCommerce widgets added through Elementor's WordPress widgets rendered unstyled. The theme's
elementor/widgets/wordpress/widget_argsfilter builds the wrapper as<aside class="widget {classes}">, butaccelerate_widget_class_names()only knows the theme's own widgets and returned an empty string for everything else, so the wrapper was<aside class="widget ">and selectors such aswidget_shopping_cartnever matched. For widgets outside the theme's list the class is now read from the registered widget's ownclassnameoption, and the value is escaped; the theme's own widgets still use the existing map and are unchanged.The issue suggests preserving the incoming
before_widget, but Elementor passes an emptybefore_widgetto this filter (its own wrapper is separate), so there is nothing to preserve. Theidis also left out on purpose: Elementor's widget id is the widget type, so it would repeat if the same widget is used twice on a page.Verified live on an Elementor page containing the Cart, Search and TG: Call To Action widgets (Elementor enabled for the test requests only, test page deleted afterwards):
widgetwidget woocommerce widget_shopping_cartwidgetwidget widget_searchwidget widget_call_to_action(screenshots and gif are in a secret gist, fine to delete once reviewed)
How to test the changes in this Pull Request:
widget woocommerce widget_shopping_cartandwidget widget_search.widget widget_call_to_action.Types of changes:
Other information:
Changelog entry
Fix - Core and WooCommerce widgets added through Elementor now keep their widget classes and styling.