2014-02-07 45 views
0

我想创建一个WordPress用户可以设置他的twitter,facebook,...地址的管理区域的页面。这是我第一次尝试这样的事情,我发现它很复杂。保存和检索信息从wordpress数据库

搜索网,阅读在这里和那里,我已经把这个代码放在一起对我function.php:

<div class="wrap"> 
    <h2>BUNT THEME SETTINGS</h2> 
    <br> 
    <br> 
    <h3>1. Social Media Icons</h3> 
    <p>Here you can set the addresses for your Social Media pages. The buttons will automatically show up on your blog.</p> 

    <form method="post" action="options.php"> 
     <?php wp_nonce_field("update-option") ?> 
     <p><strong>1.1 TWITTER:</strong> 
      <input type="text" name="twitterid" size="70" value="<?php echo get_option('twitterid'); ?>" /> 
     </p> 
     <p><input class="button button-primary" type="submit" name="submit" value="Save changes" /></p> 
     <input type="hidden" name="action" value="update" /> 
     <input type="hidden" name="page_options" value="twitterid" /> 
    </form> 
</wrap> <!-- end .wrap --> 

这将创建在设置菜单的子菜单与字段中插入一个Twitter地址和“保存更改”按钮

当我输入一个地址并点击“保存更改”我送送回到options.php显示:?

“你确定要这么做

请重试。“

(“请再试一次”是一个链接,将带我们回到我的新设置页面,该字段再次为空)。

我的目标是用户输入Twitter地址,稍后将添加到博客上的Twitter按钮。所以我想通往这的方法是存储地址,然后检索按钮。这是做到这一点的方式吗?

为什么不能正常工作?我怎样才能解决这个问题?

谢谢!

回答

相关问题