让我说我使用$query = new WP_Query( arguments );
或$worksArray = get_posts( args );
在哪里可以找到返回列表的可用字段,以便知道从帖子中获取什么内容?
foreach ($worksArray as $work) {
$work->ID
}
除了id之外,$ work对象还有什么?
我找不到返回类型的类图/引用。该法典文件说it returns the list of posts
但没有链接可以看到这些帖子可以是什么或者哪些字段在那里。
(例如:$work->the_title()
,$work->something_else
)
答案 0 :(得分:1)
来自页面:http://codex.wordpress.org/Function_Reference/get_post#Return
返回的字段为:
ID (integer) The post ID
post_author (integer) The post author's ID
post_date (string) The datetime of the post (YYYY-MM-DD HH:MM:SS)
post_date_gmt (string) The GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
post_content (string) The post's contents
post_title (string) The post's title
post_category (integer) The post category's ID.
post_excerpt (string) The post excerpt
post_status (string) The post status
comment_status (string) The comment status (open|closed|registered_only)
ping_status (string) The pingback/trackback status (open|closed)
post_password (string) The post password
post_name (string) The post's URL slug
to_ping (string) URLs to be pinged
pinged (string) URLs already pinged
post_modified (string) The last modified datetime of the post
post_modified_gmt (string) The last modified GMT datetime of the post
post_content_filtered (string)
post_parent (integer) The parent post's ID (for attachments, etc)
guid (string) A link to the post.
menu_order (integer)
post_type (string) (post|page|attachment)
post_mime_type (string) Mime Type (for attachments, etc)
comment_count (integer) Number of comments