PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.83
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.83
51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 All 39 releases
← All changes | includes/helpers/Woo_Builder/Abstract_Archive_Widget.php +41 -2 51.1.4451.1.83 View file →
@@ -7,8 +7,9 @@
7 7
8 8 namespace King_Addons;
9 9
10 10 use Elementor\Widget_Base;
11 +use King_Addons\Woo_Builder\Context as Woo_Context;
11 12
12 13 if (!defined('ABSPATH')) {
13 14 exit;
14 15 }
@@ -18,8 +19,31 @@
18 19 */
19 20 abstract class Abstract_Archive_Widget extends Widget_Base
20 21 {
21 22 /**
23 + * Check if we should render the widget.
24 + * Returns true if in editor editing archive template or on actual archive page.
25 + *
26 + * @return bool
27 + */
28 + protected function should_render(): bool
29 + {
30 + // In editor mode editing product_archive template
31 + if (class_exists('King_Addons\\Woo_Builder\\Context') && Woo_Context::is_editing_template_type('product_archive')) {
32 + return true;
33 + }
34 +
35 + // On actual archive page
36 + if (function_exists('is_woocommerce') && is_woocommerce()) {
37 + if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
38 + return true;
39 + }
40 + }
41 +
42 + return false;
43 + }
44 +
45 + /**
22 46 * Render placeholder when archive context is missing.
23 47 *
24 48 * @return void
25 49 */
@@ -24,16 +48,31 @@
24 48 * @return void
25 49 */
26 50 protected function render_missing_archive_notice(): void
27 51 {
28 - if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) {
52 + $is_editor = false;
53 + if (class_exists('King_Addons\\Woo_Builder\\Context')) {
54 + $is_editor = Woo_Context::is_editor();
55 + }
56 +
57 + $is_elementor_edit = false;
58 + if (class_exists('\Elementor\Plugin') && \Elementor\Plugin::$instance && isset(\Elementor\Plugin::$instance->editor)) {
59 + $is_elementor_edit = \Elementor\Plugin::$instance->editor->is_edit_mode();
60 + }
61 +
62 + if (!$is_editor && !$is_elementor_edit) {
29 63 return;
30 64 }
31 65
66 + // Check if we're editing an Archive template but context is not set
67 + if (class_exists('King_Addons\\Woo_Builder\\Context') && Woo_Context::is_editing_template_type('product_archive')) {
68 + // Don't show notice - we're in the right template type
69 + return;
70 + }
71 +
32 72 echo '<div class="king-addons-woo-builder-notice">' . esc_html__('This widget works only on WooCommerce archive pages.', 'king-addons') . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
33 73 }
34 74 }
35 -
36 75
37 76
38 77
39 78