| 1 |
<?php |
| 2 |
/** |
| 3 |
* Include & register widget. |
| 4 |
* |
| 5 |
* @package LearnPress/Widgets |
| 6 |
* @author ThimPress <Nhamdv> |
| 7 |
* @version 4.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
require_once dirname( __FILE__ ) . '/widgets/course-extra.php'; |
| 13 |
require_once dirname( __FILE__ ) . '/widgets/course-info.php'; |
| 14 |
require_once dirname( __FILE__ ) . '/widgets/course-progress.php'; |
| 15 |
require_once dirname( __FILE__ ) . '/widgets/featured-courses.php'; |
| 16 |
require_once dirname( __FILE__ ) . '/widgets/popular-courses.php'; |
| 17 |
require_once dirname( __FILE__ ) . '/widgets/recent-courses.php'; |
| 18 |
|
| 19 |
add_action( |
| 20 |
'widgets_init', |
| 21 |
function() { |
| 22 |
register_widget( 'LP_Widget_Course_Extra' ); |
| 23 |
register_widget( 'LP_Widget_Course_Info' ); |
| 24 |
register_widget( 'LP_Widget_Course_Progress' ); |
| 25 |
register_widget( 'LP_Widget_Featured_Courses' ); |
| 26 |
register_widget( 'LP_Widget_Popular_Courses' ); |
| 27 |
register_widget( 'LP_Widget_Recent_Courses' ); |
| 28 |
} |
| 29 |
); |
| 30 |
|
| 31 |
add_action( |
| 32 |
'wp_enqueue_scripts', |
| 33 |
function() { |
| 34 |
if ( isset( $_GET['legacy-widget-preview'] ) ) { |
| 35 |
wp_enqueue_style( 'learnpress-widgets-admin', LP_PLUGIN_URL . 'assets/css/widgets.css', array() ); |
| 36 |
} |
| 37 |
} |
| 38 |
); |
| 39 |
|
| 40 |
add_action( |
| 41 |
'elementor/editor/before_enqueue_scripts', |
| 42 |
function() { |
| 43 |
wp_enqueue_script( 'learnpress-widgets-eleentor-select2', LP_PLUGIN_URL . 'assets/src/js/vendor/select2.full.min.js', array( 'jquery' ), false ); |
| 44 |
wp_enqueue_script( 'learnpress-widgets-eleentor', LP_PLUGIN_URL . 'assets/js/dist/admin/pages/widgets.js', array( 'jquery' ), false ); |
| 45 |
} |
| 46 |
); |
| 47 |
|
| 48 |
|