WordPress: Template Tags/the excerpt:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == 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 edito...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== 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 [[WordPress:Glossary#Excerpt|teaser]] which refers to the first 55 words of the post's content. Also in the latter case, [[WordPress:Glossary#HTML|HTML]] tags and graphics are stripped from the excerpt's content. This tag must be within [[WordPress:The Loop]].
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 [[WordPress:Glossary#Excerpt|teaser]] which refers to the first 55 words of the post's content. Also in the latter case, [[WordPress:Glossary#HTML|HTML]] tags and graphics are stripped from the excerpt's content. This tag must be within [[WordPress:The Loop]].
显示当前文章的摘录,结尾有[...],[...]并不是一个"阅读更多"链接。如果你没有提供一篇清晰明了的文章摘录(在文章编辑器的可选择的摘录区),标签会显示[[WordPress:Glossary#Excerpt|teaser]],指的是文章内容的前55个字。同时在后一种情况下,[[WordPress:Glossary#HTML|HTML]]标签和图形都从摘录内容中清除了。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。


== Usage ==
== Usage ==
== 用法 ==
%%% <?php the_excerpt(); ?> %%%


%%% <?php the_excerpt(); ?> %%%
%%% <?php the_excerpt(); ?> %%%


== Examples ==
== Examples ==
==例子 ==


=== Default Usage ===
=== Default Usage ===
=== 默认用法 ===


Displays the post excerpt. Used on non-single/non-permalink posts as a replacement for [[WordPress:Template_Tags/the_content|the_content()]] to force excerpts to show within the Loop.
Displays the post excerpt. Used on non-single/non-permalink posts as a replacement for [[WordPress:Template_Tags/the_content|the_content()]] to force excerpts to show within the Loop.
显示文章摘录。将非单一/非permalink的文章用在一个代替品,替换[[WordPress:Template_Tags/the_content|the_content()]],迫使摘录在Loop内显示。


  <?php the_excerpt(); ?>
  <?php the_excerpt(); ?>
<?php the_excerpt(); ?>


=== Use with Conditional Tags ===
=== Use with Conditional Tags ===
=== 与条件式标签一起使用 ===


Replaces the_content() tag with the_excerpt() when on archive (tested by <tt>is_archive()</tt>) or category (<tt>is_category()</tt>) pages.
Replaces the_content() tag with the_excerpt() when on archive (tested by <tt>is_archive()</tt>) or category (<tt>is_category()</tt>) pages.
在归档网页(由 <tt>is_archive()</tt>测试)或者在类别网页(<tt>is_category()</tt>)上时,将the_content()标签替换为the_excerpt()。


Both the examples below work for versions 1.5 and above.
Both the examples below work for versions 1.5 and above.
下面的两个例子在1.5版本以及更高的版本中都能够运行。
%%% <?php if(is_category() || is_archive()) {
the_excerpt();
} else {
the_content();
} ?> %%%


%%% <?php if(is_category() || is_archive()) {
%%% <?php if(is_category() || is_archive()) {
第28行: 第57行:


For versions of WordPress prior to 1.5, only the following will work :  
For versions of WordPress prior to 1.5, only the following will work :  
对于WordPress1.5之前的版本,只有下面的能够运行:
%%% <?php if($cat || $m) {
the_excerpt();
} else {
the_content();
} ?> %%%


%%% <?php if($cat || $m) {
%%% <?php if($cat || $m) {
第36行: 第74行:


== Parameters ==
== Parameters ==
== 参数 ==


This tag has no parameters.
This tag has no parameters.
这个标签没有参数。
== Comparison of the_excerpt() vs. the_content() ==


== Comparison of the_excerpt() vs. the_content() ==
== 比较 the_excerpt() the_content() ==


Sometimes is more meaningful to use only [[WordPress:Template_Tags/the_content|the_content()]] function. [[WordPress:Template_Tags/the_content|the_content()]] will decide what to display according to whether %%%<!--More-->%%% tag was used.
Sometimes is more meaningful to use only [[WordPress:Template_Tags/the_content|the_content()]] function. [[WordPress:Template_Tags/the_content|the_content()]] will decide what to display according to whether %%%<!--More-->%%% tag was used.
有时候只使用[[WordPress:Template_Tags/the_content|the_content()]]函数,更有意义。[[WordPress:Template_Tags/the_content|the_content()]]根据是否使用了%%%<!--More-->%%%标签,来决定显示什么。


%%%<!--More-->%%% tag splits post/page into two parts: only content before tag should be displayed in listing.
%%%<!--More-->%%% tag splits post/page into two parts: only content before tag should be displayed in listing.
%%%<!--More-->%%%标签将文章/网页分成了两个部分:只有标签之前的内容可以显示在列表上。


Remember that %%%<!--More-->%%% is (of course) ignored when showing only post/page (singles).
Remember that %%%<!--More-->%%% is (of course) ignored when showing only post/page (singles).
记住,当只显示文章/网页(单一的)的时候,(当然)忽视了%%%<!--More-->%%%。


== Related ==
== Related ==
== 相关的==


{{Tag Post Tags}}
{{Tag Post Tags}}


{{No Param Tag Footer}}
{{No Param Tag Footer}}
{{标签文章标签}}
{{没有Param标签页底文字}}

2008年7月9日 (三) 17:32的版本

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 WordPress:The Loop.

显示当前文章的摘录,结尾有[...],[...]并不是一个"阅读更多"链接。如果你没有提供一篇清晰明了的文章摘录(在文章编辑器的可选择的摘录区),标签会显示teaser,指的是文章内容的前55个字。同时在后一种情况下,HTML标签和图形都从摘录内容中清除了。必须在The Loop内使用这个标签。

Usage

用法

%%% <?php the_excerpt(); ?> %%%

%%% <?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.

显示文章摘录。将非单一/非permalink的文章用在一个代替品,替换the_content(),迫使摘录在Loop内显示。

<?php the_excerpt(); ?>

<?php the_excerpt(); ?>

Use with Conditional Tags

与条件式标签一起使用

Replaces the_content() tag with the_excerpt() when on archive (tested by is_archive()) or category (is_category()) pages.

在归档网页(由 is_archive()测试)或者在类别网页(is_category())上时,将the_content()标签替换为the_excerpt()。

Both the examples below work for versions 1.5 and above.

下面的两个例子在1.5版本以及更高的版本中都能够运行。

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

	the_excerpt();
} else {
	the_content();
} ?> %%%


%%% <?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();
} ?> %%%


%%% <?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 %%%%%% tag was used.

有时候只使用the_content()函数,更有意义。the_content()根据是否使用了%%%%%%标签,来决定显示什么。

%%%%%% tag splits post/page into two parts: only content before tag should be displayed in listing.

%%%%%%标签将文章/网页分成了两个部分:只有标签之前的内容可以显示在列表上。

Remember that %%%%%% is (of course) ignored when showing only post/page (singles).

记住,当只显示文章/网页(单一的)的时候,(当然)忽视了%%%%%%。

Related

相关的

模板:Tag Post Tags

模板:No Param Tag Footer the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

模板:没有Param标签页底文字