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

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == Displays the contents of the current post. This tag must be within WordPress:The_Loop. If the quicktag <tt><!--more--></tt> is used in a post to designate th...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述 ==


Displays the contents of the current post. This tag must be within [[WordPress:The_Loop]].
Displays the contents of the current post. This tag must be within [[WordPress:The_Loop]].
显示当前文章的内容。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。


If the quicktag <tt>&lt;!--more--&gt;</tt> 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 <tt>&lt;!--more--&gt;</tt> quicktag point on non-single/non-[[WordPress:Glossary#Permalink|permalink]] post pages.  By design, <tt>the_content()</tt> tag includes a parameter for formatting the <tt>&lt;!--more--&gt;</tt> content and look, which creates a link to "continue reading" the full post.
If the quicktag <tt>&lt;!--more--&gt;</tt> 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 <tt>&lt;!--more--&gt;</tt> quicktag point on non-single/non-[[WordPress:Glossary#Permalink|permalink]] post pages.  By design, <tt>the_content()</tt> tag includes a parameter for formatting the <tt>&lt;!--more--&gt;</tt> content and look, which creates a link to "continue reading" the full post.
如果一篇文章中使用了quicktag <tt>&lt;!—更多的--&gt;</tt>,指定文章中可以摘录部分的"切断"点,the_content()标签会在非单一/非[[WordPress:Glossary#Permalink|permalink]]文章网页上显示到<tt>&lt;!—更多的--&gt;</tt> quicktag切断点为止的摘录部分。<tt>the_content()</tt>标签有意包含一个参数,用来形成<tt>&lt;!—更多的--&gt;</tt>内容和外观的格式,创建一个链接,链接到"继续阅读"全文。


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


== Usage ==
== Usage ==
== 用法 ==
%%% <?php the_content('more_link_text', strip_teaser, 'more_file'); ?> %%%


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


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


=== Designating the "More" Text ===
=== Designating the "More" Text ===
=== 指定 "More" 文本 ===


Displays the content of the post and uses "Read more..." for the more link text when the <tt>&lt;!--more--&gt;</tt> Quicktag is used.
Displays the content of the post and uses "Read more..." for the more link text when the <tt>&lt;!--more--&gt;</tt> Quicktag is used.
显示文章内容,使用<tt>&lt;!--more--&gt;</tt> Quicktag时,为更多的链接文本使用"阅读更多的..."


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


=== Include Title in "More" ===
=== Include Title in "More" ===
===在 "更多的"中包含标题 ===


Similar to the above example, but thanks to [[WordPress:Template Tags/the title|the_title()]] tag and the ''display'' parameter, it can show "Continue reading ''ACTUAL POST TITLE''" when the <tt>&lt;!--more--&gt;</tt> Quicktag is used.
Similar to the above example, but thanks to [[WordPress:Template Tags/the title|the_title()]] tag and the ''display'' parameter, it can show "Continue reading ''ACTUAL POST TITLE''" when the <tt>&lt;!--more--&gt;</tt> Quicktag is used.
与以上的例子相似,但是多亏了[[WordPress:Template Tags/the title|the_title()]]标签和''显示''参数,使用tt>&lt;!--more--&gt;</tt> Quicktag时,可以显示"继续阅读 ''真正的文章标题''"。


  <?php the_content("Continue reading " . the_title(&#39;&#39;, &#39;&#39;, false)); ?>
  <?php the_content("Continue reading " . the_title(&#39;&#39;, &#39;&#39;, false)); ?>
<?php the_content("继续阅读 " . the_title(&#39;&#39;, &#39;&#39;, false)); ?>


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


; more_link_text : (''string'') The link text to display for the "more" link. Defaults to <tt>'(more...)'</tt>.
; more_link_text : (''string'') The link text to display for the "more" link. Defaults to <tt>'(more...)'</tt>.
; more_link_text : (''string'')为"more"链接显示的链接文本。默认为<tt>'(more...)'</tt>。
; strip_teaser : (''boolean'') Should the text before the "more" link be hidden (<tt>TRUE</tt>) or displayed (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
; strip_teaser : (''boolean'') Should the text before the "more" link be hidden (<tt>TRUE</tt>) or displayed (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
; strip_teaser : (''boolean'') "more"之前的文本应该隐藏(<tt>正确的</tt>)还是显示(<tt>错误的</tt>)。默认为<tt>错误的</tt>。
; 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'') 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 ==
== Related ==
== 相关的==


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


{{PHP Function Tag Footer}}
{{PHP Function Tag Footer}}
{{标签文章标签}}
{{PHP函数标签页底文字}}

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,