久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

編輯“WordPress:Creating Options Pages

跳轉(zhuǎn)至: 導(dǎo)航、? 搜索
警告:您沒(méi)有登錄。如果您做出任意編輯,您的IP地址將會(huì)公開(kāi)可見(jiàn)。如果您登錄創(chuàng)建一個(gè)賬戶,您的編輯將歸屬于您的用戶名,且將享受其他好處。

該編輯可以被撤銷(xiāo)。 請(qǐng)檢查下面的對(duì)比以核實(shí)您想要撤銷(xiāo)的內(nèi)容,然后發(fā)布下面的更改以完成撤銷(xiāo)。

最后版本 您的文本
第1行: 第1行:
== Introduction ==
== Introduction ==
== 介紹 ==


Creating custom options panels in WordPress is relatively easy.
Creating custom options panels in WordPress is relatively easy.
在WordPress中創(chuàng)建自定義選項(xiàng)面板,較為簡(jiǎn)單。


Firstly, to create the menu item and the new page, see [[WordPress:Adding Administration Menus]].
Firstly, to create the menu item and the new page, see [[WordPress:Adding Administration Menus]].
首先,請(qǐng)看看[[WordPress:Adding Administration Menus|添加管理菜單]],創(chuàng)建菜單內(nèi)容和新的頁(yè)面。


So long as you stick to this structure, WordPress will handle all of the option creation, update, saving, and redirection for you. It will check permissions, and do all that other magic behind the scenes.
So long as you stick to this structure, WordPress will handle all of the option creation, update, saving, and redirection for you. It will check permissions, and do all that other magic behind the scenes.
只要你遵循這個(gè)結(jié)構(gòu),WordPress會(huì)處理所有的選項(xiàng)創(chuàng)建,更新,保存和更改的內(nèi)容。WordPress會(huì)檢查權(quán)限,并且在幕后操作進(jìn)行許多其它神奇的操作。


== Form Tag ==
== Form Tag ==
== 表格標(biāo)簽 ==


Once you have your page, you need to create an HTML form. Use this code:
Once you have your page, you need to create an HTML form. Use this code:
創(chuàng)建了網(wǎng)頁(yè)后,你就需要?jiǎng)?chuàng)建HTML表格。使用這個(gè)代碼:
? <form method="post" action="options.php">
? <form method="post" action="options.php">
<form method="post" action="options.php">
== nonce Magic ==


== nonce Magic ==
== nonce Magic ==
第33行: 第16行:
Then after the opening form tag, insert this PHP code:
Then after the opening form tag, insert this PHP code:
? <?php wp_nonce_field('update-options'); ?>
? <?php wp_nonce_field('update-options'); ?>
打開(kāi)表格標(biāo)簽后,插入這個(gè)PHP代碼:
<?php wp_nonce_field('update-options'); ?>


This will insert two hidden fields which automatically help to check that the user can update options and also redirect the user back to the correct admin page (because the form action is a different page).
This will insert two hidden fields which automatically help to check that the user can update options and also redirect the user back to the correct admin page (because the form action is a different page).
這樣會(huì)插入兩個(gè)隱藏的欄,可以自動(dòng)地幫助核對(duì),用戶可以更新選項(xiàng),也可以使用戶返回到當(dāng)前的管理頁(yè)面(因?yàn)閒orm action是個(gè)不同的頁(yè)面)。


== Update Options Button ==
== Update Options Button ==
== 更新選項(xiàng)按鈕 ==


At this point you may choose to insert the standard Update Options button, the HTML for which is:
At this point you may choose to insert the standard Update Options button, the HTML for which is:
這時(shí),你可以選擇插入標(biāo)準(zhǔn)的更新選項(xiàng)按鈕,HTML是:
? &lt;p class="submit">
? &lt;p class="submit">
<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" /&gt;
</p>
&lt;p class="submit">
? <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" /&gt;
? <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" /&gt;
? </p>
? </p>


Note the use of the _e() function to handle translation of the text, see [[WordPress:Localizing WordPress]] for more info.
Note the use of the _e() function to handle translation of the text, see [[WordPress:Localizing WordPress]] for more info.
注意使用the _e() function處理文本翻譯,更多的信息,請(qǐng)看看[[WordPress:Localizing WordPress|WordPress本地化]]。


== Field Names ==
== Field Names ==
== Field 名稱 ==


Use fields with the same names that you want your newly created options (stored in the options table) to be called, for example:
Use fields with the same names that you want your newly created options (stored in the options table) to be called, for example:
使用欄的名稱,與你希望最新創(chuàng)建的選項(xiàng)(儲(chǔ)存在選項(xiàng)表格中)得到調(diào)用的名稱相同,例如:
? <input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" />
? <input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" />
<input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" />


Note that by using the get_option() function as the value for the field, this will automatically be updated when the options are saved.
Note that by using the get_option() function as the value for the field, this will automatically be updated when the options are saved.
注意通過(guò)使用get_option()函數(shù)作為欄的參數(shù)值,選項(xiàng)保存的時(shí)候,這會(huì)自動(dòng)更新。
== action Field ==


== action Field ==
== action Field ==
第86行: 第39行:
Next, create a hidden field called action containing the value update.
Next, create a hidden field called action containing the value update.
? <input type="hidden" name="action" value="update" />
? <input type="hidden" name="action" value="update" />
其次,創(chuàng)建創(chuàng)建隱藏的欄called action,包含更新的參數(shù)值。
<input type="hidden" name="action" value="update" />
== page_options Field ==


== page_options Field ==
== page_options Field ==


Finally, create a hidden field called page_options containing a comma separated list of all the options in the page that should be written on save.
Finally, create a hidden field called page_options containing a comma separated list of all the options in the page that should be written on save.
最后,創(chuàng)建包含用逗號(hào)分開(kāi)的網(wǎng)頁(yè)中所有選項(xiàng)的列表,稱為page_options,隱藏的field,編寫(xiě)這些網(wǎng)頁(yè)時(shí),應(yīng)該保存。
? <input type="hidden" name="page_options" value="new_option_name,some_other_option,option_etc" />
? <input type="hidden" name="page_options" value="new_option_name,some_other_option,option_etc" />
<input type="hidden" name="page_options" value="new_option_name,some_other_option,option_etc" />


== Closing Tags ==
== Closing Tags ==
== 關(guān)閉標(biāo)簽==


Then obviously close the form tag after your other options, and if you like, include another "Update Options" button, this is the WordPress default.
Then obviously close the form tag after your other options, and if you like, include another "Update Options" button, this is the WordPress default.
接著,很明顯,在你的其它選項(xiàng)之后,關(guān)閉表格標(biāo)簽,如果你愿意,可以加上另一個(gè)"更新選項(xiàng)"按鈕,這個(gè)按鈕是WordPress默認(rèn)帶有的。
? &lt;p class="submit">
? &lt;p class="submit">
<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
</p>
</form>
&lt;p class="submit">
? <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
? <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
? </p>
? </p>
? </form>
? </form>
請(qǐng)注意,您對(duì)站長(zhǎng)百科的所有貢獻(xiàn)都可能被其他貢獻(xiàn)者編輯,修改或刪除。如果您不希望您的文字被任意修改和再散布,請(qǐng)不要提交。
您同時(shí)也要向我們保證您所提交的內(nèi)容是您自己所作,或得自一個(gè)不受版權(quán)保護(hù)或相似自由的來(lái)源(參閱Wordpress-mediawiki:版權(quán)的細(xì)節(jié))。 未經(jīng)許可,請(qǐng)勿提交受版權(quán)保護(hù)的作品!
取消 編輯幫助(在新窗口中打開(kāi))