我已检索到WP\\u Post对象,并将其存储在变量中。
Array
(
[0] => WP_Post Object
(
[ID] => 45
[post_author] => 1
[post_date] => 2014-03-10 14:22:01
[post_date_gmt] => 2014-03-10 14:22:01
[post_content] =>
[post_title] => sddddddddddd
[post_excerpt] =>
[post_status] => publish
[comment_status] => closed
[ping_status] => closed
[post_password] =>
[post_name] => sddddddddddd
[to_ping] =>
[pinged] =>
[post_modified] => 2014-03-10 14:23:57
[post_modified_gmt] => 2014-03-10 14:23:57
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://localhost/bitbucket/?post_type=advertisement&p=45
[menu_order] => 0
[post_type] => advertisement
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
[1] => WP_Post Object
(
[ID] => 40
[post_author] => 1
[post_date] => 2014-03-10 11:00:28
[post_date_gmt] => 2014-03-10 11:00:28
[post_content] =>
[post_title] => 123
[post_excerpt] =>
[post_status] => publish
[comment_status] => closed
[ping_status] => closed
[post_password] =>
[post_name] => 123
[to_ping] =>
[pinged] =>
[post_modified] => 2014-03-10 12:49:24
[post_modified_gmt] => 2014-03-10 12:49:24
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://localhost/bitbucket/?post_type=advertisement&p=40
[menu_order] => 0
[post_type] => advertisement
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
[2] => WP_Post Object
(
[ID] => 37
[post_author] => 1
[post_date] => 2014-03-05 13:56:15
[post_date_gmt] => 2014-03-05 13:56:15
[post_content] =>
[post_title] => asd
[post_excerpt] =>
[post_status] => publish
[comment_status] => closed
[ping_status] => closed
[post_password] =>
[post_name] => asd
[to_ping] =>
[pinged] =>
[post_modified] => 2014-03-10 14:26:23
[post_modified_gmt] => 2014-03-10 14:26:23
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://bitbucket/?post_type=advertisement&p=37
[menu_order] => 0
[post_type] => advertisement
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
()
以上是我的目标。现在,我需要将其中的一些值存储在自定义数组中,该数组如下所示:
$my_array = array (
ID => post_title
);
ID和post\\u标题应来自上面的对象。我如何才能做到这一点?