WordPress: Template Tags/single cat title:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
 
第1行: 第1行:
== Description ==
== 描述 ==
== 描述 ==
Displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (e.g. "/tag/geek") the name of the tag is displayed instead of the category. Can be used only outside [[WordPress:The Loop]].


为当前网页显示或者返回一个类别标题。对于显示WordPress标签而不是类别的网页(例如"/标签/geek"),标签名称而不是类别得到显示。只能够在[[WordPress:The Loop|The Loop]]外部使用。
为当前网页显示或者返回一个类别标题。对于显示WordPress标签而不是类别的网页(例如"/tag/geek"),标签名称而不是类别得到显示。只能够在[[WordPress:The Loop|The Loop]]外部使用。
 
== Usage ==


== 用法 ==
== 用法 ==
第11行: 第7行:
%%% <?php single_cat_title('prefix', 'display'); ?> %%%
%%% <?php single_cat_title('prefix', 'display'); ?> %%%


%%% <?php single_cat_title('prefix', 'display'); ?> %%%
== Examples ==


== 例子 ==
== 例子 ==
This example displays the text "'''Currently browsing '''" followed by the category title.


这个例子在类别标题的后面显示了文本"'''当前浏览'''"。
这个例子在类别标题的后面显示了文本"'''当前浏览'''"。
&lt;p&gt;<?php single_cat_title('Currently browsing '); ?>.&lt;/p&gt;
<div style="border:1px solid blue; width:50%; padding:10px">Currently browsing WordPress.</div>




第30行: 第17行:
<div style="border:1px solid blue; width:50%; padding:10px">当前浏览WordPress。</div>
<div style="border:1px solid blue; width:50%; padding:10px">当前浏览WordPress。</div>


This example assigns the current category title to the variable $current_category for use in PHP.


这个例子将当前类别标题分配给变数variable $current_category,在PHP中使用。
这个例子将当前类别标题分配给变数variable $current_category,在PHP中使用。
第37行: 第22行:
  <?php $current_category = single_cat_title("", false); ?>
  <?php $current_category = single_cat_title("", false); ?>


<?php $current_category = single_cat_title("", false); ?>
== Parameters ==


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


; prefix : (''string'') Text to output before the category title. Defaults to <tt>&#39;&#39;</tt> (no text).
;prefix : (''string'') 在类别标签前的文本。默认<tt>&#39;&#39;</tt> (没有文本)。
; display : (''boolean'') Display the category's title (<tt>TRUE</tt>) or return it for use in PHP (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
 
; 前缀 : (''string'') 在类别标签前的文本。默认<tt>&#39;&#39;</tt> (没有文本)。
 
; 显示 : (''boolean'')显示类别的标题 (<tt>真的</tt>) 或者将其返回,在PHP 中使用 (<tt>错误的</tt>)。默认<tt>真的</tt>。
 
== Related ==
 
{{Tag Category Tags}}


{{PHP Function Tag Footer}}
;display: (''boolean'')显示类别的标题 (<tt>TRUE</tt>) 或者将其返回,在PHP 中使用 (<tt>FALSE</tt>)。默认<tt>TRUE</tt>。


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

2008年7月5日 (六) 17:56的最新版本

描述[ ]

为当前网页显示或者返回一个类别标题。对于显示WordPress标签而不是类别的网页(例如"/tag/geek"),标签名称而不是类别得到显示。只能够在The Loop外部使用。

用法[ ]

%%% <?php single_cat_title('prefix', 'display'); ?> %%%


例子[ ]

这个例子在类别标题的后面显示了文本"当前浏览"。


<p><?php single_cat_title('Currently browsing '); ?>.</p>

当前浏览WordPress。


这个例子将当前类别标题分配给变数variable $current_category,在PHP中使用。

<?php $current_category = single_cat_title("", false); ?>


参数[ ]

prefix
(string) 在类别标签前的文本。默认'' (没有文本)。
display
(boolean)显示类别的标题 (TRUE) 或者将其返回,在PHP 中使用 (FALSE)。默认TRUE

相关的[ ]

模板:标签类别标签

模板:PHP 函数标签页底文字