我目前正在开发一个简单的插件。激活我的插件工作正常。然而,只要我的插件处于活动状态,我就不能激活任何其他插件。此外,编辑链接也不起作用。
这方面的任何帮助都将是巨大的!下面是主插件文件sponsoren的代码。php
<?php
/*
Plugin Name: Sponsoren
Plugin URI:
Version:
Author:
Description:
*/
// Enqueue Scripts
add_action( \'admin_enqueue_scripts\', \'sponsoren_admin\' );
add_action(\'admin_menu\', \'sponsoren_custom_menu_page\');
add_action( \'wp_enqueue_scripts\', \'sponsoren_frontend\' );
function sponsoren_custom_menu_page() {
$page = add_menu_page( \'Sponsoren\', \'Sponsoren\', \'manage_options\',
\'sponsoren/sponsoren-admin.php\', \'\', plugins_url( \'sponsoren/images/icon.png\' ), 33 );
}
function sponsoren_admin() {
wp_enqueue_style( \'sponsoren-admin-style\', plugins_url(\'/stylesheet.css\', __FILE__) );
wp_enqueue_script( \'sponsoren-admin-script\', plugins_url(\'/script.js\', __FILE__) );
}
function sponsoren_frontend() {
wp_enqueue_style( \'sponsoren-frontend-style\', plugins_url(\'/sponsoren.css\', __FILE__) );
wp_enqueue_script( \'sponsoren-frontend-script\', plugins_url(\'/sponsoren.js\', __FILE__), array( \'jquery\' ) );
}
// Create database table upon activation
function jal_install() {
global $wpdb;
$table_name = $wpdb->prefix . "sponsoren";
$sql = "CREATE TABLE $table_name (
id int NOT NULL AUTO_INCREMENT,
name tinytext,
bild tinytext,
url tinytext,
PRIMARY KEY id (id)
);";
}
register_activation_hook( __FILE__, \'jal_install\' );
// Ajax action used in sponsoren-admin.php
add_action(\'wp_ajax_sponsor_delete\', \'sponsor_del\');
function sponsor_del() {
global $wpdb;
$wpdb->delete( $wpdb->prefix.\'sponsoren\', array( \'id\' => $_POST[\'deleteid\'] ) );
die();
}
// Widget
function widget_sponsoren_frontend($args=array(), $params=array()) {
$title = get_option(\'widget_sponsoren_title\');
echo $before_widget;
echo $before_title . $title . $after_title;
// some more widget output
echo $after_widget;
}
wp_register_sidebar_widget(\'widget_sponsoren\',\'Unsere Sponsoren\', \'widget_sponsoren_frontend\');
// Widget Options
wp_register_widget_control(
\'widget_sponsoren\', // id
\'widget_sponsoren\', // name
\'widget_sponsoren_control\' // callback function
);
function widget_sponsoren_control($args=array(), $params=array()) {
if (isset($_POST[\'submitted\'])) {
update_option(\'widget_sponsoren_title\', $_POST[\'widgettitle\']);
}
$widgettitle = get_option(\'widget_sponsoren_title\');
?>
Widget Title:<br />
<input type="text" class="widefat" name="widgettitle" value="<?php echo stripslashes($widgettitle); ?>" />
<input type="hidden" name="submitted" value="0" />
<?php
}