Cannot override most Mega Menu Widgets
-
The Mega Menu Widgets are being loaded by
APMM_Class->ap_megamenu_includes()
which checks if the$id
exists as a Class or not before loading it. It pulls that list fromAPMM_Class->menuincludes()
which holds the following:return array( 'wpmegamenuwalker_class' => APMM_PATH . 'inc/frontend/WPMegamenuWalker_Class.php', 'ap_menu_settings' => APMM_PATH . 'inc/admin/menu_settings_class.php', //admin menu display class 'ap_theme_settings' => APMM_PATH . 'inc/admin/theme_settings_class.php', //admin menu display class 'wpmm_menu_widget_manager' => APMM_PATH . 'inc/admin/widget-manager_class.php', 'wp_mega_menu_widget' => APMM_PATH . 'inc/admin/wpmegamenu-widget.php', );
When it loads the
wp_mega_menu_widget
Class using that Array, it is also actually loading theWP_Mega_Menu_Contact_Info
,WP_Mega_Menu_PRO_LinkImage
, andWP_Mega_Menu_PRO_HtmlText
Classes since they are all in the same file, which means that if those Classes already exist, it still loads the file as it never checked for those.This would normally be fine as the Classes are individually wrapped by
if ( ! class_exists() )
, but since this happens at the instantiation of the main Plugin Class rather than at a Hook it makes it very challenging to include your own version of the Class(es) before it can. I’ve tried naming the directory of my own plugin things like0-ap-mega-menu-overrides
andaap-mega-menu-overrides
to try to get mine to load up first and nothing seems to outspeed the inclusion of that file in the AP Mega Menu plugin.If
APMM_Class->ap_megamenu_includes()
could run atplugins_loaded
or later and/or a Filter be placed onAPMM_Class->menuincludes()
to modify the returned Array that would be very helpful! I really appreciate the work you’ve done with this plugin! It has saved me a lot of time so far.
- The topic ‘Cannot override most Mega Menu Widgets’ is closed to new replies.