get_page()通过页面id获取页面信息

目录

描述

Retrieves page data given a page ID or page object.

Pages provide a way to have static content that will not affect things like articles or archives or any other blog entry features of WordPress. Its simply a way to turn a blog entry into static content.

get_page() 描述

用法

<?php get_page$page_id ?>

get_page() 用法

参数

$page_id

(integer) (必填) Page ID passed by reference (see example below)

默认值: Page ID from global variable at time function is called

$output

(OBJECT/ARRAY_A/ARRAY_N) (可选) What to output.

默认值: OBJECT

$filter

(string) (可选) How the return value should be filtered. Options are 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The 'attribute' and 'js' contexts are treated like 'display'.

默认值: 'raw'

get_page() 参数

返回值

(object|array) 

mixed Page data.

If you need the URL to the Page, don't try and use the guid value. Use the_permalink or get_permalink instead.

If a page is not found, a null value is returned.

This page is marked as incomplete. You can help Codex by expanding it.

get_page() 返回值

示例

This example code can be used when you want to include the text of a specific page in a theme.

get_page() 示例

历史

  • Deprecated: 3.5.0
  • 添加于 版本: 1.5.1

get_page() 历史

源文件

get_page() 函数的代码位于
wp-includes/post.php.

get_page() 源文件

相关