翻译自WordPress Chinese 中文文档

Description

描述

Displays the excerpt of the current post with […] at the end, which is not a read more link. If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt field), it will display a teaser which refers to the first 55 words of the post's content. Also in the latter case, HTML tags and graphics are stripped from the excerpt's content. This tag must be within The Loop.If the current post is an attachment, such as in the attachment.php and image.php template loops, then the attachment caption is displayed. Captions do not include the excerpt […] marks.

显示当前文档的摘要,并且在末尾添加[…],它并不是一个更多阅读的链接。如果你不提供一个显示的摘要在一个文章里面(在文章编辑器里有可选摘要域),它将显示一个teaser,自动的截取文章内容的前55个单词。随之的情景,HTML标签以及图形将在摘要中被忽略掉。这个标签必须在Loop内。如果当前的文档是一个附件,正像在attachment.php和image.php模板中的Loop一样,这样附件标题将被显示出来。标题不会包括摘要的[…]标记。

Usage

使用方法

%%% ?php the_excerpt(); ? %%%

Examples

例子

Default Usage

默认的使用方法

Displays the post excerpt. Used on non-single/non-permalink posts as a replacement for the_content() to force excerpts to show within the Loop.

显示文章摘要。在非单独或非永久性链接的文章中使用,从而替换the_content()在Loop当中强制显示摘要。

?php the_excerpt(); ?

Use with Conditional Tags

附加标签的使用

Replaces the_content() tag with the_excerpt() when on archive (tested by ttis_archive()/tt) or category (ttis_category()/tt) pages.

Both the examples below work for versions 1.5 and above.

在文档(用ttis_archive()/tt测试)或目录(ttis_category()/tt)中用the_excerpt()替换the_content()。

下面的例子都适用于WordPress1.5以上的版本.

%%% ?php if(is_category() || is_archive()) {

the_excerpt();

}

else {

the_content();

} ? %%%

For versions of WordPress prior to 1.5, only the following will work :

只有下面的代码适用于WordPress1.5以前的版本:

%%% ?php if($cat || $m) {

the_excerpt();

}

else {

the_content();

} ? %%%

Parameters

参数

This tag has no parameters.

这个标签没有参数。

Comparison of the_excerpt() vs. the_content()

对比the_excerpt()和 the_content()

Sometimes is more meaningful to use only the_content() function. the_content() will decide what to display according to whether %%%!–more–%%% tag was used. %%%!–more–%%% tag splits post/page into two parts: only content before tag should be displayed in listing. Remember that %%%!–more–%%% is (of course) ignored when showing only post/page (singles).

仅仅使用the_content()函数,有时候也是非常有意思的。根据是否使用%%%!–more–%%% 标签,the_content()决定将显示什么内容。 %%%!–more–%%%标签将文章或页分成两部分:在列表中仅仅显示出标签前面的内容。 当然要记住%%%!–more–%%%标签在单独的文章或页当中将被忽略掉。

php theexcerpt,WordPress:the excerpt(摘要)相关推荐

  1. php theexcerpt,wordpress的excerpt()函数的用法示例

    本篇文章给大家带来的内容是关于wordpress的excerpt()函数的用法示例,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 问题:在wordpres中的single页面,本身引 ...

  2. WordPress 首页显示摘要

    这里的方法不需要你另外装插件. 1.使用more标签 (缺点:每次都要加一下这个东西,不灵活只能一刀切.优点:方法比较正规不需要改动模版) 在你需要截断的地方(就是你的编辑框)加 <!–more ...

  3. WordPress页面、文章、分类等的条件判断的标签集合

    is_home() //判断是否为首页. #The Front Page 首页头版消息设置 is_front_page() //判断是否为首页头版消息. (无论是日志或是页面).当系统显示博客主页且管 ...

  4. 转载一篇介绍 WordPress 的文章

    Wordpress简明使用指南 从今年9月到现在,我用Wordpress也有大约3个月了.现将自己使用中的一些体会分简介.安装.一般使用.主题.插件.代码修改等几个部分逐一概述如下. 1. 简介 Wo ...

  5. 分享:Wordpress-woocommerce-storefront主题首页和文章页显示文章全文 如何修改为只显示标题和摘要?

    引言: 最近在学习Wordpress网站,使用了woocommerce-storefront主题,该商城主题是免费的,这很重要...并为storefront建立了子主题EUTTEST. 首先说明我不是 ...

  6. 个人网站学习实践(wordpress教程)

    个人网站学习实践(wordpress教程) from: http://www.xifengxx.com/wordpress-study 序: 还在上大学的时候,便有建立个人网站的想法. 那时清闲,去图 ...

  7. 简单步骤实现wordpress添加og协议

    这是在网络上搜集到 关于wordpress 添加og协议的代码.但是好像并不适用爱地狱资源网 /** * WordPress 星火计划原创保护专用META优化代码(最终版) */ add_action ...

  8. 增加seo好感度,wordpress给文章增加og协议,即meta标签形式如 meta property=”og:

    这个标题是什么意思?什么是og协议.先不说到底是什么意思.可能大家在一些博客上面,有时候一篇文章,你查看源代码的时候,会在里面,发现如"meta property="og:desc ...

  9. Open Source

    资源来源于http://www.cnblogs.com/Leo_wl/category/246424.html RabbitMQ 安装与使用 摘要: RabbitMQ 安装与使用 前言 吃多了拉就是队 ...

  10. Laravel自定义错误提示语语言包

    1.下载语言包: 语言包git库: https://github.com/caouecs/Laravel-lang 这里面有68国语言,我这里只需要中文包,因此,我就在另外一个地方clone了这个仓库 ...

最新文章

  1. 报告 | 电竞中高端人才平均年薪21.6万元,仅次于金融业
  2. Linux下安装oracle报错
  3. short 类型的大小为( )个字节。_2008-2012,张一鸣在豆瓣书影音为字节跳动埋下的5个彩蛋...
  4. 模块间接口设计的原则
  5. 【转】Castle Windsor之组件注册
  6. 【WebRTC---进阶篇】(六)SELECT网络模型
  7. kaili camera
  8. 80C51汇编语言有哪几条常用伪指令,单片微机原理与接口技术答案(宋跃版)
  9. 数据线为什么不弄两头都是Typec接口的呢?
  10. 关于HashMap,HashTable,HashSet浅析
  11. python性能解决的事_Python程序的性能分析方法
  12. 英伟达各版本CUDA地址以及与驱动对应关系
  13. golang学习之五:error、painc、recover
  14. 叶文贤:胸怀绿色润滑 锻造品牌灵魂
  15. QML 导入ttf图标库
  16. 程序员能纯靠技术渡过中年危机吗?
  17. Java研发技术学习路线
  18. C++中虚函数的理解,以及简单继承情况下的虚函数的表!
  19. 算法图解第十、十一章读书笔记
  20. 《2021勒索病毒大盘点》

热门文章

  1. PAT 7-14 电话聊天狂人
  2. 爬虫之Scrapy文件爬取
  3. Python基础:第25课——使用类和实例
  4. 【Unity】超级坦克大战(十三)闯关流程:关卡界面逻辑
  5. 代码坏味道 之 9 基本类型偏执 primitive obsession
  6. 北斗在线app服务器,北斗卫星导航app,北斗卫星导航app官网手机版预约 v1.0 - 浏览器家园...
  7. SIP12 脚 电磁隔离放大器IC 模拟信号隔离放大器 电磁耦合隔离放大器
  8. 带有图形界面的通用趋势
  9. 方舟服务器显示网络错误,方舟生存进化提示网络错误怎么办
  10. X在苍茫大地 闻一达(闻大嘴) 闻明远