WordPress:Template Tags/the content

来自站长百科
Fludlen讨论 | 贡献2008年7月9日 (三) 15:35的版本
跳转至: 导航、​ 搜索

Description

描述

Displays the contents of the current post. This tag must be within WordPress:The_Loop.

显示当前文章的内容。必须在The Loop内使用这个标签。

If the quicktag <!--more--> is used in a post to designate the "cut-off" point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-permalink post pages. By design, the_content() tag includes a parameter for formatting the <!--more--> content and look, which creates a link to "continue reading" the full post.

如果一篇文章中使用了quicktag <!—更多的-->,指定文章中可以摘录部分的"切断"点,the_content()标签会在非单一/非permalink文章网页上显示到<!—更多的--> quicktag切断点为止的摘录部分。the_content()标签有意包含一个参数,用来形成<!—更多的-->内容和外观的格式,创建一个链接,链接到"继续阅读"全文。

Note:

注:

  • No whitespaces are allowed before the "more" in the <!--more--> quicktag. In other words <!-- more --> will not work!
  • <!—更多的--> quicktag中的"更多的"之前,不允许有空格。换句话说,<!-- more --> 不能运行!
  • The <!--more--> quicktag will not operate and is ignored if there is only one post being displayed.
  • <!--more--> quicktag不会运行,而且如果只显示一篇文章的话,会忽视<!--more--> quicktag。

Usage

用法

%%% <?php the_content('more_link_text', strip_teaser, 'more_file'); ?> %%%

%%% <?php the_content('more_link_text', strip_teaser, 'more_file'); ?> %%%

Examples

例子

Designating the "More" Text

指定 "More" 文本

Displays the content of the post and uses "Read more..." for the more link text when the <!--more--> Quicktag is used.

显示文章内容,使用<!--more--> Quicktag时,为更多的链接文本使用"阅读更多的..."

<?php the_content('Read more...'); ?>

<?php the_content('Read more...'); ?>

Include Title in "More"

在 "更多的"中包含标题

Similar to the above example, but thanks to the_title() tag and the display parameter, it can show "Continue reading ACTUAL POST TITLE" when the <!--more--> Quicktag is used.

与以上的例子相似,但是多亏了the_title()标签和显示参数,使用tt><!--more--> Quicktag时,可以显示"继续阅读 真正的文章标题"。

<?php the_content("Continue reading " . the_title('', '', false)); ?>

<?php the_content("继续阅读 " . the_title('', '', false)); ?>

Parameters

参数

more_link_text
(string) The link text to display for the "more" link. Defaults to '(more...)'.
more_link_text
(string)为"more"链接显示的链接文本。默认为'(more...)'
strip_teaser
(boolean) Should the text before the "more" link be hidden (TRUE) or displayed (FALSE). Defaults to FALSE.
strip_teaser
(boolean) "more"之前的文本应该隐藏(正确的)还是显示(错误的)。默认为错误的
more_file
(string) File the "more" link points to. Defaults to the current file. (V2.0: Currently the 'more_file' parameter doesn't work).
more_file
(string) "more"链接指向的文件。默认为当前文件。(2.0版本: 当前'more_file' 参数不能运行)。

Related

相关的

模板:Tag Post Tags

模板:PHP Function 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,