首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否提醒用户主题选项已保存?

是否提醒用户主题选项已保存?
EN

Stack Overflow用户
提问于 2011-02-13 21:34:12
回答 1查看 160关注 0票数 2

我正在为我的主题创建一个主题选项页面,我想在他们的选项已保存时提醒用户。知道怎么回事吗?下面是我在functions.php代码中使用的代码。

代码语言:javascript
复制
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']);
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-14 05:54:23

在表单之前尝试此操作。如果它起作用了,请告诉我。谢谢!

代码语言:javascript
复制
    if($_REQUEST['updated'] == 'true') {
            echo '<div><p>Theme Options Saved! </p></div>
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4984422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档