wordpress函数get_page()

get_page 跟 get_post 一样,只不过是用来获取单个页面对象的, WordPress 很好的把数据库的读取和数据的组装进行了封装。

描述

获取页面对象的一个函数。

注意:需要单独讲一下就是只能获得你在页面编辑时输入的内容。

使用

<?php
// 调用方法:
echo get_page( $page_id)->ID; // 输出页面的ID,//$page_id为页面ID号,后台可以找到
// ID              :页面ID号
// post_author     :作者ID
// post_date       :时间
// post_content    :页面内容
// post_title      :页面标题
// post_excerpt    :页面摘要
// post_status     :页面状态(发布,审核,加密等)
// comment_status  :评论状态(开启或关闭)
// ping_status     :Ping状态(开启或关闭)
// post_password   :页面密码
// post_name       :页面名称
// post_modified   :页面修改时间
// post_parent     :页面父级名称
// guid            :页面URl地址
// menu_order      :排序
// post_type       :类型Page
// comment_count   :评论数量
?>

总结

另外 get_page 函数也有一个复数形式就是 get_pages get_posts一样。