脚本宝典收集整理的这篇文章主要介绍了php – 如何从WP_Post对象获取标题,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array('post_tyPE' => 'page')); // Get the page as an Object $portfolio = get_page_by_tITle('service'); // Filter through all pages and find Portfolio's children $portfolio_children = get_page_children( $portfolio->ID,$all_wp_pages ); // echo what we get back From WP to the browser echo "<PRe>";print_r( ); foreach($portfolio_children as $pagedet): echo $pagedet['post_title']; enDForeach;
我在使用foreach之前得到数组
when i print $portfolio_children iam getting out put like this Array ( [0] => WP_Post Object ( [ID] => 201 [post_title] => Website Hosting ) [1]=> WP_Post Object ( [ID] => 202 [post_title] => Website )
在foreach之后,如果我打印$pagedet我得到
WP_Post Object ( [ID] => 201 [post_title] => Website Hosting )
以上是脚本宝典为你收集整理的php – 如何从WP_Post对象获取标题全部内容,希望文章能够帮你解决php – 如何从WP_Post对象获取标题所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。