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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.