我正在使用get_post_meta($post->ID);
,它会返回如下所示的结果。
我需要在屏幕上打印这些字段的实际值wpcf-business_listing_title,wpcf-street_address,wpcf-city等。
我该怎么做?谢谢!
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"
}
}
答案 0 :(得分:1)
这里你可以给出特定的字段slug名称,例如你用于wpcf-street_address然后你想要给出类似
$wpcf-street_address = get_post_meta($post->ID,'wpcf-street_address',true);
这为您提供了特定的字段值。