当我们在做 WordPress 开发及优化的时候,其中最重要的就是 WordPress 循环,我们大多的内容输出都是通过 wp_query 及 query_posts 函数来循环输出,同样我们很多时候也会使用 get_post 函数来获取指定文章的内容。
而在获取到这些内容的时候我们该如何调用呢?我们就需要知道不论是循环的多篇内容还是单篇内容,都需要知道具体的输出字段,这样才能便于我们直接调用。
WP_Post Object
(
[ID] =>
[post_author] =>
[post_date] =>
[post_date_gmt] =>
[post_content] =>
[post_title] =>
[post_excerpt] =>
[post_status] =>
[comment_status] =>
[ping_status] =>
[post_password] =>
[post_name] =>
[to_ping] =>
[pinged] =>
[post_modified] =>
[post_modified_gmt] =>
[post_content_filtered] =>
[post_parent] =>
[guid] =>
[menu_order] =>
[post_type] =>
[post_mime_type] =>
[comment_count] =>
[filter] =>
)
举例
$post = get_post( 10 ); $pid = $post->ID;
还没有评论,来说两句吧...