I want to create a Wordpress plugin, but after replacing a few words with Notepad, the whole plugin won't show up anymore. I have tried checking all lines, reverting it back to what it was, nothing. It's dead! I hope someone can help me out, this really frustrates me.
<?php
function em_settings_page() {
global $em_options;
$selected_page = ! empty( $em_options['page'] ) ? $em_options['page'] : 0;
?>
<div class="wrap">
<div id="upb-wrap" class="upb-help">
<h1><?php
$maintenance = __('Maintenance');
$settings = __('Settings');
echo "$maintenance $settings";
?></h1>
<?php
if ( ! isset( $_REQUEST['updated'] ) )
$_REQUEST['updated'] = false;
?>
<?php if ( false !== $_REQUEST['updated'] ) : ?>
<div class="updated fade"><p><?php _e( 'Options saved' ); ?></p></div>
<?php endif; ?>
<form method="post" action="options.php">
<table class="form-table">
<?php settings_fields( 'em_settings_group' ); ?>
<tr>
<td><strong><?php echo __('Enabled'); ?></strong></td>
<td><input id="em_settings[enable]" class="js_enabled" name="em_settings[enable]" type="checkbox" value="1" <?php checked( true, isset( $em_options['enable'] ) ); ?>/></td>
</tr>
<tr>
<td><strong><?php echo __('Page'); ?></strong></td>
<td>
<?php $pages = get_pages(); ?>
<select id="em_settings[page]" name="em_settings[page]">
<?php foreach($pages as $page) { ?>
<option value="<?php echo esc_attr( $page->ID ); ?>" <?php if( $selected_page == $page->ID ) { echo 'selected="selected"'; } ?>><?php echo $page->post_title; ?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="button-primary" value="<?php _e( 'Save' ); ?>" /></td>
</tr>
</table>
</form>
</div>
</div>
<?php
}
function em_register_settings() {
register_setting( 'em_settings_group', 'em_settings' );
}
add_action( 'admin_init', 'em_register_settings' );
function em_settings_menu() {
add_submenu_page('options-general.php', __('Maintenance'), __('Maintenance'),'manage_options', 'maintenance', 'em_settings_page');
}
add_action( 'admin_menu', 'em_settings_menu' );
function maintenance_stylesheet() {
?>
<style type="text/css">
#wpadminbar #wp-admin-bar-maintenance {background-color:#c30000;}
#wpadminbar #wp-admin-bar-maintenance a {font-weight:bold;}
</style>
<?php
}
add_action('admin_head', 'maintenance_stylesheet');
if($em_options['enable'] == "1") {
function create_maintenance_menu() {
global $wp_admin_bar;
$menu_id = 'maintenance';
$wp_admin_bar->add_menu(array(
'id' => $menu_id,
'title' => __('Maintenance'),
'href' => 'options-general.php?page=maintenance'
));
}
add_action('admin_bar_menu', 'create_maintenance_menu', 2000);
}
?>
So the issue is that the whole settings page isn't showing up anymore in the left sidebar of the admin backend.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire