Где я могу найти поля сообщений, возвращаемых WP_Query? - PullRequest
0 голосов
/ 09 сентября 2011

Допустим, я использую $query = new WP_Query( arguments ); или $worksArray = get_posts( args );

где я могу найти доступные поля возвращаемого списка, чтобы я знал, что получить из сообщения?

foreach ($worksArray as $work) {
  $work->ID
}

Что еще есть в объекте $ work помимо идентификатора? Я не могу найти диаграмму классов / ссылку возвращаемого типа. В документах Кодекса написано it returns the list of posts, но нет ссылки, чтобы увидеть что может быть для этих сообщений или какие поля есть.

(пример: $work->the_title(), $work->something_else)

1 Ответ

1 голос
/ 09 сентября 2011

со страницы: 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 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...