wordpress怎样调用页面内容呢?
“页面”在wordpress企业建站过程中是会经常用到的简单且好用的功能。
比如我们需要一个关于我们的企业文化介绍,就需要在wordpress后台的页面来进行编辑然后调用到前台,
这样每次更新页面内容就可以自动在首页的版块内自动更新摘要部分,加以链接到页面就可以了。
wordpress可以通过 get_page() 函数,来获得指定ID的页面的内容、标题等信息。
<?php
get_page(
$page_id
);
//$page_id为页面ID号,后台可以找到
?>
以下是关于指定页面的其他信息:
<?php
//调用方法:
echo
get_page(
$page_id
)->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:评论数量
?>
<?php
echo
mb_strimwidth(get_page(2)->post_content,0,600);?>
//这个代码也是可以调用页面的内容,好处在于限制页面内容的数字
详细信息如上面所述,可以在首页进行对指定的页面进行调用