prevent widget loading if WP_Widget does not exist
This commit is contained in:
parent
ce0559649c
commit
07d1e4949d
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (class_exists('WP_Widget')) {
|
||||||
class PluginWonderfulWidget extends WP_Widget {
|
class PluginWonderfulWidget extends WP_Widget {
|
||||||
function PluginWonderfulWidget() {
|
function PluginWonderfulWidget() {
|
||||||
$widget_options = array(
|
$widget_options = array(
|
||||||
@ -55,5 +56,6 @@ class PluginWonderfulWidget extends WP_Widget {
|
|||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -34,8 +34,10 @@ 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'));
|
||||||
add_action('init', array($plugin_wonderful, 'init'));
|
add_action('init', array($plugin_wonderful, 'init'));
|
||||||
|
Loading…
Reference in New Issue
Block a user