]> _ Git - physioassist-de.git/commitdiff
wait #7216 @2:00
authorsoufiane <soufiane@cubedesigners.com>
Mon, 2 Dec 2024 16:01:51 +0000 (17:01 +0100)
committersoufiane <soufiane@cubedesigners.com>
Mon, 2 Dec 2024 16:01:51 +0000 (17:01 +0100)
wp-content/mu-plugins/physioassist/src/Elementor/Setup.php
wp-content/themes/physioassist/resources/assets/styles/components/headings.styl

index 8b0d1ab483eb78e3f6a58aa27d107c0db427e40e..f9e13ffe607af353094235bef741f2d28c0d16c8 100644 (file)
@@ -22,20 +22,14 @@ class Setup {
 
         //--- Heading Widget
         // Extend Elementor's heading widget to add a CSS class based on the alignment setting so we can also control the position of the underline
-        add_action( 'elementor/element/heading/section_title/before_section_end', function( $element, $args ) {
-            $elementor = Plugin::instance();
-
-            // Get the align control for updating
-            $control_data = $elementor->controls_manager->get_control_from_stack( $element->get_name(), 'align' );
-
-            if (is_wp_error($control_data)) {
-                return;
+        add_action( 'elementor/widget/before_render_content', function( $widget ) {
+            if ('heading' === $widget->get_name()) {
+                $settings = $widget->get_settings();
+                if ( ! empty( $settings['align'] ) ) {
+                    $widget->add_render_attribute('_wrapper', 'class', 'heading-align-'. $settings['align']);
+                }
             }
-
-            // Add a prefix class so heading will have correct class applied when alignment is changed
-            $control_data['prefix_class'] = 'heading-align-';
-            $element->update_control( 'align', $control_data );
-        }, 10, 2);
+        });
 
         // Todo: consider add a control to the existing heading widget that allows the underline to be disabled (via prefix_class?)
 
@@ -58,7 +52,6 @@ class Setup {
             $element->update_control( 'icon_active', $icon_active_control );
         }, 10, 2);
 
-
     }
 
     public function register_widgets() {
@@ -135,4 +128,4 @@ class Setup {
 
     }
 
-}
+}
\ No newline at end of file
index 9a6a1a5eb64a6a5c99c347933f69eeba444c96f6..f343189b0a4a3a566e9c8f196f6c776d3253f0df 100644 (file)
@@ -39,11 +39,11 @@ h1, h2
     height: 3px
     background-color: currentColor
 
-    // Center underline
-    .heading-align-center &
-      margin-left: auto
-      margin-right: auto
-
     // Right-align underline
     .heading-align-right &
       margin-left: auto
+
+.heading-align-center .elementor-heading-title:after,
+.heading-align-center .main-heading:after
+  margin-left: auto
+  margin-right: auto