我使用的是get_post_meta($post->ID);
,它返回如下结果。从Wordpress中提取值Get_Post_Meta
我需要打印到屏幕的实际值这些字段WPCF-business_listing_title,WPCF-STREET_ADDRESS,WPCF城等
究竟是如何做呢?谢谢!
array(25) {
["wpcf-business_listing_title"]=> array(1) {
[0]=> string(17) "Davis Car Dealer"
}
["wpcf-street_address"]=> array(1) {
[0]=> string(21) "720 Olympad Drive Ste X"
}
["wpcf-city"]=> array(1) {
[0]=> string(5) "Portland"
}
["wpcf-state_abbreviation"]=> array(1) {
[0]=> string(2) "ME"
}
["wpcf-full_state_name"]=> array(1) {
[0]=> string(10) "Maine"
}
["wpcf-zip_code"]=> array(1) {
[0]=> string(5) "95616"
}
["wpcf-county"]=> array(1) {
[0]=> string(4) "Yolo"
}
["wpcf-phone_number"]=> array(1) {
[0]=> string(12) "555-755-3666"
}
}
这是一个[关联数组](http://php.net/manual/en/language.types.array.php),其中每个项目包含一个带有自定义字段值的平面数组。我建议你阅读[数组](http://php.net/manual/en/language.types.array.php)和[循环](http://www.php.net/manual/en/control -structures.foreach.php)在PHP中。对于记录,使用括号表示法访问关联数组元素,例如。 * $ meta ['my-assoc-key'] * – kjetilh 2013-02-23 09:13:36