bricks
2 weeks ago
elementor
2 weeks ago
block-patterns.php
2 weeks ago
elementor-integration.php
1 month ago
index.php
1 month ago
woocommerce-myaccount.php
2 weeks ago
elementor-integration.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Elementor integration. |
| 4 | * Defines custom Elementor widgets for WAWP shortcodes. |
| 5 | * |
| 6 | * @package automation-web-platform |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Register WAWP shortcodes as Elementor widgets if Elementor is active. |
| 15 | */ |
| 16 | add_action( |
| 17 | 'plugins_loaded', |
| 18 | function () { |
| 19 | if ( did_action( 'elementor/loaded' ) ) { |
| 20 | $hook = has_action( 'elementor/widgets/register' ) ? 'elementor/widgets/register' : 'elementor/widgets/widgets_registered'; |
| 21 | |
| 22 | add_action( |
| 23 | $hook, |
| 24 | function ( $widgets_manager ) { |
| 25 | $dir = WAWP_PLUGIN_DIR . 'integrations/elementor/'; |
| 26 | require_once $dir . 'class-wawp-login-widget.php'; |
| 27 | require_once $dir . 'class-wawp-signup-widget.php'; |
| 28 | require_once $dir . 'class-wawp-fast-login-widget.php'; |
| 29 | |
| 30 | if ( method_exists( $widgets_manager, 'register' ) ) { |
| 31 | $widgets_manager->register( new WAWP_Login_Widget() ); |
| 32 | $widgets_manager->register( new WAWP_Signup_Widget() ); |
| 33 | $widgets_manager->register( new WAWP_Fast_Login_Widget() ); |
| 34 | } else { |
| 35 | $widgets_manager->register_widget_type( new WAWP_Login_Widget() ); |
| 36 | $widgets_manager->register_widget_type( new WAWP_Signup_Widget() ); |
| 37 | $widgets_manager->register_widget_type( new WAWP_Fast_Login_Widget() ); |
| 38 | } |
| 39 | } |
| 40 | ); |
| 41 | } |
| 42 | } |
| 43 | ); |
| 44 |