diff --git a/core/includes/class-tm-mega-menu-widget-manager.php b/core/includes/class-tm-mega-menu-widget-manager.php index 4c1c557..c4d0671 100644 --- a/core/includes/class-tm-mega-menu-widget-manager.php +++ b/core/includes/class-tm-mega-menu-widget-manager.php @@ -28,7 +28,6 @@ class tm_mega_menu_widget_manager { * @since 1.0.0 */ public function __construct() { - add_action( 'init', array( $this, 'register_sidebar' ) ); add_action( 'wp_ajax_tm_mega_menu_edit_widget', array( $this, 'show_widget_form' ) ); @@ -39,6 +38,32 @@ public function __construct() { add_action( 'wp_ajax_tm_mega_menu_move_widget', array( $this, 'move_widget' ) ); add_filter( 'widget_update_callback', array( $this, 'persist_tm_mega_menu_widget_settings' ), 10, 4 ); + + // Compatibility with WordPress 4.8 (text and media Widgets) + add_action( 'admin_footer-nav-menus.php', array( $this, 'admin_print_footer_scripts' ) ); + add_action( 'admin_print_scripts-nav-menus.php', array( $this, 'admin_print_scripts' ) ); + add_action( 'admin_print_styles-nav-menus.php', array( $this, 'admin_print_styles' ) ); + } + + /** + * Print the widgets.php admin scripts on the nav-menus.php page. + */ + public function admin_print_footer_scripts() { + do_action( 'admin_footer-widgets.php' ); + } + + /** + * Print the widgets.php admin scripts on the nav-menus.php page. + */ + public function admin_print_scripts() { + do_action( 'admin_print_scripts-widgets.php' ); + } + + /** + * Print the widgets.php admin styles on the nav-menus.php page. + */ + public function admin_print_styles() { + do_action( 'admin_print_styles-widgets.php' ); } /** @@ -399,14 +424,16 @@ public function _show_widget_form( $widget_id ) { ?>
- - + + +
+
Delete | Close @@ -494,7 +521,7 @@ public function get_widget_html( $title, $widget_id, $cols, $total_cols ) { ' . $cols . '/' . $total_cols . '
-
'; +
'; } /** diff --git a/tm-mega-menu.php b/tm-mega-menu.php index 67cc4b5..564d354 100644 --- a/tm-mega-menu.php +++ b/tm-mega-menu.php @@ -2,7 +2,7 @@ /** * Plugin Name: TM Mega Menu * Description: A megamenu management plugin for WordPress. - * Version: 1.1.3 + * Version: 1.1.4 * Author: TemplateMonster * Author URL: http://www.templatemonster.com/wordpress-themes.php * Text Domain: tm-mega-menu @@ -25,7 +25,7 @@ final class tm_mega_menu { * @var string * @since 1.0.0 */ - public $version = '1.1.3'; + public $version = '1.1.4'; /** * @var string