2014-02-07 43 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按鈕。所以我想通往這的方法是存儲地址,然後檢索按鈕。這是做到這一點的方式嗎?

爲什麼不能正常工作?我怎樣才能解決這個問題?

謝謝!

回答

相關問題