prevent widget loading if WP_Widget does not exist
This commit is contained in:
parent
ce0559649c
commit
07d1e4949d
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class PluginWonderfulWidget extends WP_Widget {
|
if (class_exists('WP_Widget')) {
|
||||||
|
class PluginWonderfulWidget extends WP_Widget {
|
||||||
function PluginWonderfulWidget() {
|
function PluginWonderfulWidget() {
|
||||||
$widget_options = array(
|
$widget_options = array(
|
||||||
'classname' => 'plugin-wonderful',
|
'classname' => 'plugin-wonderful',
|
||||||
@ -54,6 +55,7 @@ class PluginWonderfulWidget extends WP_Widget {
|
|||||||
if (!isset($instance['center'])) { $instance['center'] = 0; }
|
if (!isset($instance['center'])) { $instance['center'] = 0; }
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -34,7 +34,9 @@ define('PLUGIN_WONDERFUL_UPDATE_TIME', 60 * 60 * 12); // every 12 hours
|
|||||||
$plugin_wonderful = new PluginWonderful();
|
$plugin_wonderful = new PluginWonderful();
|
||||||
|
|
||||||
function __plugin_wonderful_load_widgets() {
|
function __plugin_wonderful_load_widgets() {
|
||||||
|
if (class_exists('WP_Widget')) {
|
||||||
register_widget('PluginWonderfulWidget');
|
register_widget('PluginWonderfulWidget');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('admin_menu', array($plugin_wonderful, 'set_up_menu'));
|
add_action('admin_menu', array($plugin_wonderful, 'set_up_menu'));
|
||||||
|
Loading…
Reference in New Issue
Block a user