WordPress: Template Tags/the title attribute:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
== Description ==
== 描述 ==
== 描述 ==
Displays or returns the title of the current post. It somewhat duplicates the functionality of [[WordPress:Template_Tags/the_title|the_title()]], but provides a 'clean' version of the title by stripping [[WordPress:Glossary#HTML|HTML]] tags and converting certain characters (including quotes) to their [[WordPress:Glossary#Character_Entity|character entity]] equivalent; it also uses  [[WordPress:Template_Tags/How_to_Pass_Tag_Parameters#Tags_with_query-string-style_parameters|query-string style parameters]]. This tag must be within [[WordPress:The Loop]].


显示或者返回当前文章的标题。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。
显示或者返回当前文章的标题。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。
== Usage ==


== 用法 ==
== 用法 ==


%%% <?php the_title_attribute('arguments'); ?> %%%
%%% <?php the_title_attribute('arguments'); ?> %%%
== Example ==


==例子 ==
==例子 ==


  <?php the_title_attribute('before=&lt;h3&gt;&amp;after=&lt;/h3&gt;'); ?>
  <?php the_title_attribute('before=&lt;h3&gt;&amp;after=&lt;/h3&gt;'); ?>
== Parameters ==


== 参数 ==
== 参数 ==


; before : (''string'') Text to place before the title. Defaults to <tt>&#39;&#39;</tt>.
; before : (''string'') 标题之前放置的文本。默认为<tt>&#39;&#39;</tt>。
;之前: (''string'')标题之前放置的文本。默认为<tt>&#39;&#39;</tt>。
; after : (''string'') Text to place after the title. Defaults to <tt>&#39;&#39;</tt>.


;之后:(''string'')标题之后放置的文本。默认为<tt>&#39;&#39;</tt>。
; after : (''string'') 标题之后放置的文本。默认为<tt>&#39;&#39;</tt>。


; echo : (''Boolean'') Echo the title (<tt>1</tt>) or return it for use in PHP (<tt>0</tt>). Defaults to <tt>1</tt>.
; echo : (''Boolean'') Echo the title (<tt>1</tt>) or return it for use in PHP (<tt>0</tt>). Defaults to <tt>1</tt>.
== Related ==


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


See also [[WordPress:Template_Tags/the_title|the_title()]].
也看看[[WordPress:Template_Tags/the_title_attribute|the_title()]]
也看看[[WordPress:Template_Tags/the_title_attribute|the_title_attribute()]]
{{Tag Post Tags}}


{{Query String Tag Footer}}
{{标签文章标签}}
{{标签文章标签}}


{{PHP函数标签页底文字}}
{{PHP函数标签页底文字}}

2008年7月17日 (四) 11:07的版本

描述

显示或者返回当前文章的标题。必须在The Loop内使用这个标签。

用法

%%% <?php the_title_attribute('arguments'); ?> %%%

例子

<?php the_title_attribute('before=<h3>&after=</h3>'); ?>

参数

before
(string) 标题之前放置的文本。默认为''
after
(string) 标题之后放置的文本。默认为''
echo
(Boolean) Echo the title (1) or return it for use in PHP (0). Defaults to 1.

相关的

也看看the_title()

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,