WIKI使用導(dǎo)航
站長百科導(dǎo)航
站長專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機(jī)
- cPanel
- 網(wǎng)址導(dǎo)航專題
- 云計(jì)算
- 微博營銷
- 虛擬主機(jī)管理系統(tǒng)
- 開放平臺(tái)
- WIKI程序與應(yīng)用
- 美國十大主機(jī)
WordPress:Function Reference/get post custom keys
來自站長百科
描述[ ]
返回一個(gè)數(shù)組,包含某篇文章或者網(wǎng)頁的所有自定義fields。也看看get_post_custom() 和get_post_custom_values()
用法[ ]
%%% <?php get_post_custom_keys($post_id); ?> %%%
例子[ ]
默認(rèn)用法[ ]
下面的例子會(huì)將一個(gè)變數(shù)($custom_field_keys)設(shè)置為一個(gè)數(shù)組,包含當(dāng)前文章的所有自定義fields的關(guān)鍵詞,然后再輸出。
<?php $custom_field_keys = get_post_custom_keys(); foreach ( $custom_field_keys as $key => $value ) echo $key . " => " . $value . "<br />"; ?>
If the post contains custom fields with the keys mykey and yourkey, the output would be:
0 => mykey
1 => yourkey
2 => _edit_last
3 => _edit_lock
4 => _wp_page_template
注:不管一個(gè)關(guān)鍵字分配了多少參數(shù)值(自定義fields),關(guān)鍵字在數(shù)組中只顯示一次。
參數(shù)[ ]
相關(guān)的[ ]
add_post_meta(), delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom(), get_post_custom_values()