小冬SEO

wordpress调用指定分类名称和链接

2019-02-12 16:49:24 1314 WordPress笔记

wordpress调用分类列表或者页面的名称和链接方法

WordPress通过ID获取分类目录链接:

<?php echo get_category_link( 1 );?>

调用指定分类名称:

<?php echo get_cat_name(1);?>

WordPress通过ID获取Page页面链接:

<?php echo get_page_link( 1 );?>

除此之外,wordpress中可以通过 get_page() 函数,来获得指定ID的页面的内容、标题、url等信息。

通过ID获取PAGE标题

<?php echo get_page( 1 )->post_title;?>

更多方法:

<?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 :评论数量

?>

版权保护: 本文由小冬SEO编辑发布,转载请保留链接: http://www.myseoyh.cn/shuo/106.html