Оповещение пользователей о том, что параметры темы сохранены? - PullRequest
2 голосов
/ 13 февраля 2011

Я создаю страницу параметров темы для своей темы и хочу предупредить пользователей, когда их параметры будут сохранены.Есть идеи как?Ниже мой код, который я использую в коде functions.php.

function themeoptions_page() { 
    if ( $_POST['update_themeoptions'] == 'true' ) { themeoptions_update(); }  
?>
<div class="wrap">
    <div id="icon-themes" class="icon32"><br /></div>  
    <h2>JJTheme Options</h2>
    <br><br>
    <form method="POST" action="">
        <label for="enable-header">
            Enable Header Image?
            <input type="checkbox" <?php echo (get_option('enableheader')) ? 'checked="checked"' : ''; ?> value="true" id="enable-header" name="enable-header">
        </label>
        <br><br>
        <label for="footer">Footer (HTML Allowed)</label>
        <textarea class="large-text code" cols="50" rows="3" name="footer"><?php echo get_option('footer'); ?></textarea>
        <br><br>
        <label for="ga">Google Analytics Code</label>
        <textarea class="large-text code" cols="50" rows="3" name="ga"><?php echo get_option('ga'); ?></textarea>
        <br><br>
        <input type="submit" value="Save Settings" name="save_menu" class="button-primary menu-save">
        <input type="hidden" name="update_themeoptions" value="true">  
    </form>
</div>

<?php
}

add_action('admin_menu', 'themeoptions_admin_menu');  

function themeoptions_update() {
    if ($_POST['enable-header'] == 'true') { $header = true; } else { $header = false; }  
    update_option('enableheader', $header);
    update_option('footer', $_POST['footer']);
    update_option('ga', $_POST['ga']);
}

1 Ответ

1 голос
/ 14 февраля 2011

Попробуйте это перед формой.Дайте мне знать, если это работает.Спасибо!

    if($_REQUEST['updated'] == 'true') {
            echo '<div><p>Theme Options Saved! </p></div>
}
...