首页 WordPress函数 WordPress获取文章摘要函数:get_the_excerpt
正文 评论

WordPress获取文章摘要函数:get_the_excerpt

WordPress函数get_the_excerpt用于获取文章的摘要,通常用在归档页输出文章列表时同时输出文章的摘要,文章页面也可以将摘要作为导读输出,更有用的是将摘要内容作为Descraption标签的内容。

get_the_excerpt( int $post = null )

函数参数

$post

整数型,默认值:null

提供文章的ID以获取该文章的摘要,在Loop主循环中使用时,不传递任何参数即可获取当前文章的摘要。另外,也可以传递WP_Post对象而不是ID

函数使用示例

<?php$my_excerpt = get_the_excerpt();if ( \'\' != $my_excerpt ) {//您的代码}echo $my_excerpt; // 输出摘要?>

扩展阅读

get_the_excerpt()函数位于:wp-includes/post-template.php

相关函数:

  • the_excerpt()
-=||=-收藏赞 (0)
更多主题
v1.0.0
小程序收录免费WordPress主题:XCX主题
¥ 0 关注:22,637
详情
单栏极简文艺WordPress博客主题:Diaspora主题
¥ 0 关注:22,135
详情
简约黑白WordPress个人博客主题:Personal主题
¥ 0 关注:21,864
详情
功能丰富切轻量的WordPress虚拟资源主题:Rizhuti主题
¥ 599 关注:19,929
详情
v1.0.0
一款简约单栏的免费WordPress博客主题:itheme主题
¥ 0 关注:19,841
详情
WordPress版WebStack导航主题:WebStack主题
¥ 0 关注:16,925
详情
回复
暂无评论

不要再留垃圾评论了,主题君整理资源不容易,留几句鼓励的话吧。