| @@ -27,20 +27,41 @@ | ||
| 27 | 27 | * @since 5.0.0 |
| 28 | 28 | */ |
| 29 | 29 | public function __construct( $data = [], $args = null ) { |
| 30 | 30 | parent::__construct( $data, $args ); |
| 31 | - // Block. | |
| 32 | - wp_enqueue_style( | |
| 31 | + // Register assets; Elementor enqueues via get_*_depends() when used. | |
| 32 | + wp_register_style( | |
| 33 | + 'ctc-blocks-core', | |
| 34 | + CTC_URI . 'includes/assets/css/style.css', | |
| 35 | + [], | |
| 36 | + CTC_VER, | |
| 37 | + 'all' | |
| 38 | + ); | |
| 39 | + wp_register_script( | |
| 40 | + 'ctc-lib-core', | |
| 41 | + CTC_URI . 'assets/frontend/js/lib/ctc.js', | |
| 42 | + ['jquery'], | |
| 43 | + CTC_VER, | |
| 44 | + true | |
| 45 | + ); | |
| 46 | + wp_register_script( | |
| 47 | + 'ctc-blocks-core', | |
| 48 | + CTC_URI . 'includes/assets/js/core.js', | |
| 49 | + ['ctc-lib-core'], | |
| 50 | + CTC_VER, | |
| 51 | + true | |
| 52 | + ); | |
| 53 | + wp_register_style( | |
| 33 | 54 | 'ctc-el-coupon', |
| 34 | 55 | CTC_URI . 'includes/elementor/widgets/coupon/style.css', |
| 35 | - [], | |
| 56 | + ['ctc-blocks-core'], | |
| 36 | 57 | CTC_VER, |
| 37 | 58 | 'all' |
| 38 | 59 | ); |
| 39 | - wp_enqueue_script( | |
| 60 | + wp_register_script( | |
| 40 | 61 | 'ctc-el-coupon', |
| 41 | 62 | CTC_URI . 'includes/elementor/widgets/coupon/script.js', |
| 42 | - [], | |
| 63 | + ['jquery', 'ctc-lib-core', 'ctc-blocks-core'], | |
| 43 | 64 | CTC_VER, |
| 44 | 65 | true |
| 45 | 66 | ); |
| 46 | 67 | } |