Exemple #1
0
function etheme_add_admin_menu()
{
    global $menu, $_etheme_settings_pagehook;
    $menu['58.995'] = array('', 'manage_options', 'separator-etheme', '', 'wp-menu-separator');
    $has_update = false;
    $updateNote = '';
    if (class_exists('Envato_WP_Toolkit')) {
        $has_update = Envato_WP_Toolkit::checkForUpdate(ETHEME_DOMAIN);
    }
    if ($has_update) {
        $updateNote = '<span class="awaiting-mod count-1"><span class="pending-count">1</span></span>';
    }
    add_menu_page(ETHEME_THEME_NAME . ' Theme Options', ETHEME_THEME_NAME . $updateNote, 'manage_options', 'ethemesoptions', 'etheme_theme_settings_admin', ETHEME_CODE_CSS_URL . '/images/etheme.png', '58.996');
    $_etheme_settings_pagehook = add_submenu_page('ethemesoptions', __('Theme Settings', ETHEME_DOMAIN), __('Theme Settings', ETHEME_DOMAIN), 'manage_options', 'ethemesoptions', 'etheme_theme_settings_admin');
    add_action('admin_init', 'etheme_register_theme_settings');
}
function etheme_theme_settings_admin()
{
    global $_etheme_settings_pagehook;
    ?>
	
	<div id="etheme-theme-settings" class="wrap etheme-metaboxes">
	<form method="post" action="options.php">
		<?php 
    wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
    ?>
		<?php 
    wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
    ?>
		<?php 
    settings_fields(ETHEME_OPTIONS);
    // important!
    ?>
		<?php 
    screen_icon('options-etheme');
    ?>
		<h2>
			<?php 
    echo ETHEME_THEME_NAME . ' - ' . __('Theme Settings', ETHEME_DOMAIN);
    ?>
<br>
			<input type="submit" class="button-primary"value="<?php 
    _e('Save Settings', ETHEME_DOMAIN);
    ?>
" />
            <a class="button" style="margin-top: 4px;"  onclick="return confirm('<?php 
    _e('Are you sure you want to install demo data?', ETHEME_DOMAIN);
    ?>
')" href="<?php 
    echo home_url();
    ?>
/wp-admin/admin.php?page=ethemesoptions&etheme_install=xmarket"><?php 
    _e('Install Demo Pages', ETHEME_DOMAIN);
    ?>
</a>
		</h2>
		<?php 
    if (class_exists('Envato_WP_Toolkit')) {
        Envato_WP_Toolkit::checkForUpdate(ETHEME_DOMAIN, true);
    }
    ?>
		<div class="metabox-holder clearfix">
			<div class="postbox-container-left">
			<div class="postbox-container">
				<?php 
    do_meta_boxes($_etheme_settings_pagehook, 'column1', null);
    ?>
			</div>
			</div>
			<div class="postbox-container-right">
			<div class="postbox-container">
				<?php 
    do_meta_boxes($_etheme_settings_pagehook, 'column2', null);
    ?>
			</div>
			</div>
		</div>
		<div class="bottom-buttons">
			<input type="submit" class="button-primary" value="<?php 
    _e('Save Settings', ETHEME_DOMAIN);
    ?>
" />
            <a class="button" onclick="return confirm('<?php 
    _e('Are you sure you want to install demo data?', ETHEME_DOMAIN);
    ?>
')" href="<?php 
    echo home_url();
    ?>
/wp-admin/admin.php?page=ethemesoptions&etheme_install=xmarket"><?php 
    _e('Install Demo Pages', ETHEME_DOMAIN);
    ?>
</a>
		</div>
	</form>
	</div>

<?php 
}