constructor method error
-
Activating DevDmBootstrap3 on WP 4.3.1 gives me this error:
Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct()I fixed it by changing these lines in bootstrap-custom-menu-widget.php:
function bootstrap_custom_menu() {$widget_ops = array( ‘classname’ => ‘bootstrapwidgetmenu’, ‘description’ => __(‘A custom menu widget that uses the wp_bootstrap_navwalker’, ‘devdmbootstrap3’));
$control_ops = array( ‘width’ => 300, ‘height’ => 350, ‘id_base’ => ‘bootstrap-widget-menu’);
$this->WP_Widget( ‘bootstrap-widget-menu’, __(‘Boot Strap Menu’, ‘devdmbootstrap3’), $widget_ops, $control_ops);
}to this:
function __construct() {
parent::__construct(
‘bootstrap-widget-menu’, // Base ID
__(‘Boot Strap Menu’, ‘devdmbootstrap3’), // Name
array(‘description’ => __(‘A custom menu widget that uses the wp_bootstrap_navwalker’, ‘devdmbootstrap3’), )
);
}// $widget_ops = array( ‘classname’ => ‘bootstrapwidgetmenu’, ‘description’ => __(‘A custom menu widget that uses the wp_bootstrap_navwalker’, ‘devdmbootstrap3’));
// $control_ops = array( ‘width’ => 300, ‘height’ => 350, ‘id_base’ => ‘bootstrap-widget-menu’);
// $this->WP_Widget( ‘bootstrap-widget-menu’, __(‘Boot Strap Menu’, ‘devdmbootstrap3’), $widget_ops, $control_ops);
// }Thanks for a great theme!
- The topic ‘constructor method error’ is closed to new replies.