首页 > 解决方案 > 从 WordPress 对象中检索 post_title

问题描述

我正在尝试从 WordPress 对象中检索帖子标题。

这是WP_Queryvar_dump的结果:

object(WP_Query)#4305 (49) { ["query"]=> array(2) { ["post_type"]=> string(5) "cases" ["posts_per_page"]=> int(-1) } [ "query_vars"]=> array(64) { ["post_type"]=> string(5) "cases" ["posts_per_page"]=> int(-1) ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day" ]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0 ) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author"]=> string (0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]= > int(0) ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=>string(0) "" ["s"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"] => string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in "]=> 数组(0) { } ["category__and"]=> 数组(0) { } ["post__in"]=> 数组(0) { } ["post__not_in"]=> 数组(0) { } [ "post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> 数组(0) { } ["tag_slug__and"]=> 数组(0) { } ["post_parent__in"]=>数组(0) { } ["post_parent__not_in"]=> 数组(0) { } ["author__in"]=> 数组(0) { } ["author__not_in"]=> 数组(0) { } ["ignore_sticky_posts"] => bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["nopaging"]=> bool(true) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["order "]=> string(4) "DESC" } ["tax_query"]=> object(WP_Tax_Query)#4307 (6) { ["queries"]=> array(0) { } ["relation"]=> string (3)“与”[“表别名”:protected]=> array(0) { } ["queried_terms"]=> array(0) { } ["primary_table"]=> string(8) "wp_posts" ["primary_id_column"]=> string(2) "ID " } ["meta_query"]=> object(WP_Meta_Query)#4303 (9) { ["queries"]=> array(0) { } ["relation"]=> NULL ["meta_table"]=> NULL [" meta_id_column"]=> NULL ["primary_table"]=> NULL ["primary_id_column"]=> NULL ["table_aliases":protected]=> array(0) { } ["clauses":protected]=> array(0) { } ["has_or_relation":protected]=> bool(false) } ["date_query"]=> bool(false) ["request"]=> string(259) "SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = '案例'AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_author = 44 AND wp_posts.post_status = 'private') 按 wp_posts.post_date DESC " ["posts"]=> array( 42) { [0]=> object(WP_Post)#4270 (24) { ["ID"]=> int(19269) ["post_author"]=> string(1) "2" ["post_date"]=>字符串(19)“2018 年 10 月 2 日 10:46:05”[“post_date_gmt”]=> 字符串(19)“2018 年 10 月 2 日 08:46:05”[“post_content”]=> 字符串(0) "" ["post_title"]=> string(17) "Terberg - ANNAbel" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"] => 字符串(6)“关闭”[“ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(7) "annabel" ["to_ping"]=> string(0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:37:10" ["post_modified_gmt"]=> 字符串(19) " 2018-11-15 11:37:10" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "post_modified"]=> 字符串(19) "2018-11-15 12:37:10" ["post_modified_gmt"]=> 字符串(19) "2018-11-15 11:37:10" ["post_content_filtered"]= > string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "post_modified"]=> 字符串(19) "2018-11-15 12:37:10" ["post_modified_gmt"]=> 字符串(19) "2018-11-15 11:37:10" ["post_content_filtered"]= > string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=19269" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [1]=> object(WP_Post)#4269 (24) { ["ID"]=> int(19161) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-09-28 15:46:05" ["post_date_gmt"]=> string(19) "2018-09-28 13: 46:05" ["post_content"]=> string(0) "" ["post_title"]=> string(19) "De Voordelige Groep" ["post_excerpt"]=> string(0) "" ["post_status" ]=> 字符串(7) "发布" ["comment_status"]=> 字符串(6) "已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(19) "de-voordelige-groep" ["to_ping "]=> 字符串(0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:28:00" ["post_modified_gmt" ]=> string(19) "2018-11-15 11:28:00" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=>字符串(48)“["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:28:00" ["post_modified_gmt"]=> 字符串(19) "2018- 11-15 11:28:00" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:28:00" ["post_modified_gmt"]=> 字符串(19) "2018- 11-15 11:28:00" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=19161" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [2]=> object(WP_Post)#4268 (24) { ["ID"]=> int(19163) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-09-28 15:42:12" ["post_date_gmt"]=> string(19) "2018-09-28 13: 42:12" ["post_content"]=> string(0) "" ["post_title"]=> string(16) "全球工厂" ["post_excerpt"]=> string(0) "" ["post_status"] => 字符串(7)“发布”[“comment_status”]=> 字符串(6)“已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(16) "global-factories" ["to_ping"] => string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:41:57" ["post_modified_gmt"]= > string(19) "2018-11-15 11:41:57" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string( 48) "pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:41:57" ["post_modified_gmt"]=> string(19) "2018-11- 15 11:41:57" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:41:57" ["post_modified_gmt"]=> string(19) "2018-11- 15 11:41:57" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=19163" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [3]=> object(WP_Post)#4267 (24) { ["ID"]=> int(19167) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-09-21 14:58:50" ["post_date_gmt"]=> string(19) "2018-09-21 12: 58:50" ["post_content"]=> string(0) "" ["post_title"]=> string(24) "Warmteservice Groep BV" ["post_excerpt"]=> string(0) "" ["post_status" ]=> 字符串(7) "发布" ["comment_status"]=> 字符串(6) "已关闭" ["ping_status"]=> 字符串(6) "关闭" ["post_password"]=> 字符串(0) "" ["post_name"]=> 字符串(13) "warmteservice" ["to_ping"]=>字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:00:56”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:00:56" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:00:56" ["post_modified_gmt"]=> string(19) "2018-11- 15 11:00:56" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:00:56" ["post_modified_gmt"]=> string(19) "2018-11- 15 11:00:56" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=19167" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [4]=> object(WP_Post)#4266 (24) { ["ID"]=> int(19157) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-09-21 11:26:12" ["post_date_gmt"]=> string(19) "2018-09-21 09: 26:12" ["post_content"]=> string(0) "" ["post_title"]=> string(9) "Blauwtulp" ["post_excerpt"]=> string(0) "" ["post_status"]= > 字符串(7)“发布”[“comment_status”]=>字符串(6)“关闭”["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(11) "blauwtulp-2" ["to_ping"]=>字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:46:48”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:46:48" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:46:48”[“post_modified_gmt”]=>字符串(19)“2018-11-15 11:46: 48" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:46:48”[“post_modified_gmt”]=>字符串(19)“2018-11-15 11:46: 48" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "https://www.zeo.nl/?post_type=cases&p=19157" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [5]=> object(WP_Post)#4265 (24) { ["ID"]=> int(19154) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-09-21 11:15:52" ["post_date_gmt"]=> string(19) "2018-09-21 09: 15:52" ["post_content"]=> string(0) "" ["post_title"]=> string(22) "AO Smith International" ["post_excerpt"]=> string(0) "" ["post_status" ]=> 字符串(7) "发布" ["comment_status"]=> 字符串(6) "已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(8) "ao-smith" ["to_ping"] => 字符串(0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:39:59" ["post_modified_gmt"]= > string(19) "2018-11-15 11:39:59" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string( 48) "]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:39:59" ["post_modified_gmt"]=> string(19) "2018-11-15 11 :39:59" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:39:59" ["post_modified_gmt"]=> string(19) "2018-11-15 11 :39:59" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=19154" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [6]=> object(WP_Post)#4264 (24) { ["ID"]=> int(19103) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-09-12 12:13:53" ["post_date_gmt"]=> string(19) "2018-09-12 10: 13:53" ["post_content"]=> string(0) "" ["post_title"]=> string(10) "FixFast.de" ["post_excerpt"]=> string(0) "" ["post_status" ]=> string(7) "发布" ["comment_status"]=> string(6) "关闭"["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(10) "fixfast-de" ["to_ping"]=>字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:23:55”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:23:55" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:23:55”[“post_modified_gmt”]=>字符串(19)“2018-11-15 11:23: 55" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:23:55”[“post_modified_gmt”]=>字符串(19)“2018-11-15 11:23: 55" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "https://www.zeo.nl/?post_type=cases&p=19103" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [7]=> object(WP_Post)#4263 (24) { ["ID"]=> int(19072) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-09-05 13:05:27" ["post_date_gmt"]=> string(19) "2018-09-05 11: 05:27" ["post_content"]=> string(0) "" ["post_title"]=> string(8) "Shopware" ["post_excerpt"]=> string(0) "" ["post_status"]= > 字符串(7)“发布”[“comment_status”]=>字符串(6)“关闭”["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(8) "shopware" ["to_ping"]=> string( 0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-09-05 13:30:52”[“post_modified_gmt”]=>字符串(19 ) "2018-09-05 11:30:52" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "["post_modified"]=> 字符串(19) "2018-09-05 13:30:52" ["post_modified_gmt"]=> 字符串(19) "2018-09-05 11:30:52" ["post_content_filtered" ]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "["post_modified"]=> 字符串(19) "2018-09-05 13:30:52" ["post_modified_gmt"]=> 字符串(19) "2018-09-05 11:30:52" ["post_content_filtered" ]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=19072" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [8]=> object(WP_Post)#4262 (24) { ["ID"]=> int(18910) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-07-12 14:16:15" ["post_date_gmt"]=> string(19) "2018-07-12 12: 16:15" ["post_content"]=> string(0) "" ["post_title"]=> string(11) "汉堡王" ["post_excerpt"]=> string(0) "" ["post_status"] => 字符串(7)“发布”[“comment_status”]=> 字符串(6)“关闭”["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(13) "burger-king-2" ["to_ping"] => string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 11:59:50" ["post_modified_gmt"]= > string(19) "2018-11-15 10:59:50" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string( 48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 11:59:50”[“post_modified_gmt”]=>字符串(19)“2018-11-15 10:59: 50" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 11:59:50”[“post_modified_gmt”]=>字符串(19)“2018-11-15 10:59: 50" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18910" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [9]=> object(WP_Post)#4261 (24) { ["ID"]=> int(18907) ["post_author"]= > string(1) "2" ["post_date"]=> string(19) "2018-07-12 13:50:43" ["post_date_gmt"]=> string(19) "2018-07-12 11: 50:43" ["post_content"]=> string(0) "" ["post_title"]=> string(14) "理想标准" ["post_excerpt"]=> string(0) "" ["post_status"] => 字符串(7)“发布”[“comment_status”]=> 字符串(6)“关闭”["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(14) "ideal-standard" ["to_ping"]=>字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:06:02”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:06:02" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:06:02”[“post_modified_gmt”]=>字符串(19)“2018-11-15 11:06: 02" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:06:02”[“post_modified_gmt”]=>字符串(19)“2018-11-15 11:06: 02" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18907" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [10]=> object(WP_Post)#4260 (24) { ["ID"]=> int(18760) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-07-11 12:29:18" ["post_date_gmt"]=> string(19) "2018-07-11 10: 29:18" ["post_content"]=> string(0) "" ["post_title"]=> string(18) "Thomas Stofzuigers" ["post_excerpt"]=> string(0) "" ["post_status"] => 字符串(7)“发布”[“comment_status”]=> 字符串(6)“已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(20) "thomas-stofzuigers-2" ["to_ping "]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:44:26" ["post_modified_gmt" ]=> string(19) "2018-11-15 11:44:26" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=>字符串(48)“" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:44:26" ["post_modified_gmt"]=> 字符串(19) "2018 -11-15 11:44:26" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-11-15 12:44:26" ["post_modified_gmt"]=> 字符串(19) "2018 -11-15 11:44:26" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18760" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [11]=> object(WP_Post)#4259 (24) { ["ID"]=> int(18858) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-07-11 12:10:23" ["post_date_gmt"]=> string(19) "2018-07-11 10: 10:23" ["post_content"]=> string(0) "" ["post_title"]=> string(22) "Waaijenberg Mobiliteit" ["post_excerpt"]=> string(0) "" ["post_status"] => 字符串(7)“发布”[“comment_status”]=> 字符串(6)“已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(22) "waaijenberg-mobiliteit" ["to_ping"] => string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:24:50" ["post_modified_gmt"]= > string(19) "2018-11-15 11:24:50" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string( 48) "字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:24:50”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:24:50" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:24:50”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:24:50" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "https://www.zeo.nl/?post_type=cases&p=18858" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [12]=> object(WP_Post)#4258 (24) { ["ID"]=> int(18852) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-07-11 10:04:06" ["post_date_gmt"]=> string(19) "2018-07-11 08: 04:06" ["post_content"]=> string(0) "" ["post_title"]=> string(20) "Buiskoppelingshop.nl" ["post_excerpt"]=> string(0) "" ["post_status" ]=> 字符串(7) "发布" ["comment_status"]=> 字符串(6) "已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(22) "buiskoppelingshop-nl-2" ["to_ping "]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-11-15 12:26:55" ["post_modified_gmt" ]=> string(19) "2018-11-15 11:26:55" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=>字符串(48)“字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:26:55”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:26:55" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-11-15 12:26:55”[“post_modified_gmt”]=>字符串(19) "2018-11-15 11:26:55" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "https://www.zeo.nl/?post_type=cases&p=18852" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [13]=> object(WP_Post)#4257 (24) { ["ID"]=> int(18655) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-05-24 13:10:32" ["post_date_gmt"]=> string(19) "2018-05-24 11: 10:32" ["post_content"]=> string(0) "" ["post_title"]=> string(8) "SprayPay" ["post_excerpt"]=> string(0) "" ["post_status"]= > 字符串(7)“发布”[“comment_status”]=>字符串(6)“关闭”["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(8) "spraypay" ["to_ping"]=> string( 0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-05-24 13:13:14" ["post_modified_gmt"]=> 字符串(19 ) "2018-05-24 11:13:14" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "" ["post_modified"]=> 字符串(19) "2018-05-24 13:13:14" ["post_modified_gmt"]=> 字符串(19) "2018-05-24 11:13:14" ["post_content_filtered "]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "" ["post_modified"]=> 字符串(19) "2018-05-24 13:13:14" ["post_modified_gmt"]=> 字符串(19) "2018-05-24 11:13:14" ["post_content_filtered "]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18655" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [14]=> object(WP_Post)#4256 (24) { ["ID"]=> int(18653) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-05-24 12:17:25" ["post_date_gmt"]=> string(19) "2018-05-24 10: 17:25" ["post_content"]=> string(0) "" ["post_title"]=> string(5) "Sooqr" ["post_excerpt"]=> string(0) "" ["post_status"]= > string(7) "发布" ["comment_status"]=> string(6) "关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(5) "sooqr" ["to_ping"]=> string(0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-05-24 12:17:25" ["post_modified_gmt"]=> 字符串(19) " 2018-05-24 10:17:25" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "post_modified"]=> 字符串(19) "2018-05-24 12:17:25" ["post_modified_gmt"]=> 字符串(19) "2018-05-24 10:17:25" ["post_content_filtered"]= > string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "post_modified"]=> 字符串(19) "2018-05-24 12:17:25" ["post_modified_gmt"]=> 字符串(19) "2018-05-24 10:17:25" ["post_content_filtered"]= > string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18653" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [15]=> object(WP_Post)#4255 (24) { ["ID"]=> int(18650) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-05-24 11:37:51" ["post_date_gmt"]=> string(19) "2018-05-24 09: 37:51" ["post_content"]=> string(0) "" ["post_title"]=> string(6) "Pay.nl" ["post_excerpt"]=> string(0) "" ["post_status" ]=> string(7) "发布" ["comment_status"]=> string(6) "关闭"["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(6) "pay-nl" ["to_ping"]=>字符串(0)“”[“pinged”]=>字符串(0)“”[“post_modified”]=>字符串(19)“2018-05-24 11:43:57”[“post_modified_gmt”]=>字符串(19) "2018-05-24 09:43:57" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "["post_modified"]=> 字符串(19) "2018-05-24 11:43:57" ["post_modified_gmt"]=> 字符串(19) "2018-05-24 09:43:57" ["post_content_filtered" ]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "["post_modified"]=> 字符串(19) "2018-05-24 11:43:57" ["post_modified_gmt"]=> 字符串(19) "2018-05-24 09:43:57" ["post_content_filtered" ]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18650" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [16]=> object(WP_Post)#4254 (24) { ["ID"]=> int(18645) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-05-23 16:46:32" ["post_date_gmt"]=> string(19) "2018-05-23 14: 46:32" ["post_content"]=> string(0) "" ["post_title"]=> string(11) "Hellodialog" ["post_excerpt"]=> string(0) "" ["post_status"]= > 字符串(7)“发布”[“comment_status”]=>字符串(6)“关闭”["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(11) "hellodialog" ["to_ping"]=> string( 0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-05-30 15:26:13" ["post_modified_gmt"]=> 字符串(19 ) "2018-05-30 13:26:13" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-05-30 15:26:13”[“post_modified_gmt”]=>字符串(19)“2018-05-30 13:26: 13" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "字符串(0)“”[“post_modified”]=>字符串(19)“2018-05-30 15:26:13”[“post_modified_gmt”]=>字符串(19)“2018-05-30 13:26: 13" ["post_content_filtered"]=> 字符串(0) "" ["post_parent"]=> int(0) ["guid"]=> 字符串(48) "https://www.zeo.nl/?post_type=cases&p=18645" ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [17]=> object(WP_Post)#4253 (24) { ["ID"]=> int(18643) ["post_author"]= > string(1) "3" ["post_date"]=> string(19) "2018-05-23 16:32:09" ["post_date_gmt"]=> string(19) "2018-05-23 14: 32:09" ["post_content"]=> string(0) "" ["post_title"]=> string(16) "反馈公司" ["post_excerpt"]=> string(0) "" ["post_status"] => 字符串(7)“发布”[“comment_status”]=> 字符串(6)“已关闭" ["ping_status"]=> string(6) "已关闭" ["post_password"]=> string(0) "" ["post_name"]=> string(16) "feedback-company" ["to_ping"] => 字符串(0) "" ["pinged"]=> 字符串(0) "" ["post_modified"]=> 字符串(19) "2018-05-23 16:34:46" ["post_modified_gmt"]= > string(19) "2018-05-23 14:34:46" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string( 48) "pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-05-23 16:34:46" ["post_modified_gmt"]=> string(19) "2018-05- 23 14:34:46" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "pinged"]=> string(0) "" ["post_modified"]=> string(19) "2018-05-23 16:34:46" ["post_modified_gmt"]=> string(19) "2018-05- 23 14:34:46" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(48) "https://www.zeo.nl/?post_type=cases&p=18643 " ["menu_order"]=> int(0) ["post_type"]=> string(5) "cases"

我正在尝试获取post_title. 这是我到目前为止所拥有的:

    <?php
        $args = array(
            'post_type' => 'cases',
            'posts_per_page' => -1,
        );
        $the_query = new WP_Query( $args );
        if ( $the_query->have_posts() ):
            while ( $the_query->have_posts() ): $the_query->the_post();
                $case_title = get_field('post_title');
                echo $case_title;

                var_dump($the_query);
    ?>

    <?php endwhile; wp_reset_postdata(); endif;?>

但它不是检索标题。

我应该怎么做才能检索标题?

标签: wordpresscustom-post-typeadvanced-custom-fields

解决方案


要回显标题,您可以这样做<?php the_title(); ?>并将标题放在 var 中,您可以这样做$title = get_the_title();

欲了解更多信息:https ://developer.wordpress.org/reference/functions/get_the_title/

<?php
        $args = array(
            'post_type' => 'cases',
            'posts_per_page' => -1,
        );
        $the_query = new WP_Query( $args );
        if ( $the_query->have_posts() ):
            while ( $the_query->have_posts() ): $the_query->the_post();
                $case_title = get_the_title();
                echo $case_title;
                // or
                echo the_title();

                var_dump($the_query);
    ?>

    <?php endwhile; wp_reset_postdata(); endif;?>

推荐阅读