编辑“WordPress:Template Tags/wp title

跳转至: 导航、​ 搜索
警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您登录创建一个账户,您的编辑将归属于您的用户名,且将享受其他好处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第23行: 第23行:


=== 默认用法===
=== 默认用法===
Displays the blog name (using [[WordPress:Template Tags/bloginfo|<tt>bloginfo()</tt>]]) and the post title using defaults when accessing a single post page.  If the blog name is "My WordPress Blog", and the title of the post is "Hello world!", then the example below will show the title as '''My WordPress Blog  &raquo; Hello world!


显示博客名称(使用[[WordPress:Template Tags/bloginfo|<tt>bloginfo()</tt>]]),访问只有一篇文章的网页的时候,文章标题使用默认设置。如果博客名是"我的WordPress 博客",文章标题是"世界,你好!",那么下面的例子会显示标题为'''我的 WordPress博客  &raquo; 世界,你好!
显示博客名称(使用[[WordPress:Template Tags/bloginfo|<tt>bloginfo()</tt>]]),访问只有一篇文章的网页的时候,文章标题使用默认设置。如果博客名是"我的WordPress 博客",文章标题是"世界,你好!",那么下面的例子会显示标题为'''我的 WordPress博客  &raquo; 世界,你好!
第28行: 第30行:
<pre> <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title></pre>
<pre> <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title></pre>


<pre> <title><?php bloginfo('名称'); ?> <?php wp_标题(); ?></标题></pre>
This example would the same do the same thing:


这个例子会执行同样的功能:
这个例子会执行同样的功能:


<pre> <title><?php bloginfo('name'); ?> <?php wp_title('',true,''); ?></title></pre>
<pre> <title><?php bloginfo('name'); ?> <?php wp_title('',true,''); ?></title></pre>
<pre> <title><?php bloginfo('名称'); ?> <?php wp_标题('',真的,''); ?></标题></pre>
=== Using Separator ===


=== 使用分隔符 ===
=== 使用分隔符 ===
Displays blog name (using [[WordPress:Template Tags/bloginfo|<tt>bloginfo()</tt>]]) along with post title in the document's title tag, using "--" as the separator. This results in (when on a single post page) '''My WordPress Blog--Hello world!'''.


在文件的标题标签上显示博客名(使用[[WordPress:Template Tags/bloginfo|<tt>bloginfo()</tt>]])和文章标题,使用"--"作为博客名和文章标题之间的分隔符。因此(当访问只有一篇文章的网页的时候),会出现标题'''我的 WordPress 博客—世界,你好!'''
在文件的标题标签上显示博客名(使用[[WordPress:Template Tags/bloginfo|<tt>bloginfo()</tt>]])和文章标题,使用"--"作为博客名和文章标题之间的分隔符。因此(当访问只有一篇文章的网页的时候),会出现标题'''我的 WordPress 博客—世界,你好!'''


<pre> <title><?php bloginfo('name'); ?> <?php wp_title('--'); ?></title></pre>
<pre> <title><?php bloginfo('name'); ?> <?php wp_title('--'); ?></title></pre>
<pre> <title><?php bloginfo('名称'); ?> <?php wp_表态('--'); ?></title></pre>
This example would the same do the same thing:


这个例子执行同样的功能也是一样的:
这个例子执行同样的功能也是一样的:


<pre> <title><?php bloginfo('name'); ?> <?php wp_title('--',true,''); ?></title></pre>
<pre> <title><?php bloginfo('name'); ?> <?php wp_title('--',true,''); ?></title></pre>
<pre> <title><?php bloginfo('名称'); ?> <?php wp_标题('--',真的,''); ?></标题></pre>
=== Separator with Blog Name and Title Reversed ===


=== 博客名和文章标题顺序颠倒时,之间的分隔符===
=== 博客名和文章标题顺序颠倒时,之间的分隔符===


通过移动分隔符(使用<tt>wp_title(' ')</tt>,然后测试是否存在一个文章标题(使用 <tt>if(wp_title(' ', false))</tt>),可以颠倒上面的例子中的网页标题和博客名的排列顺序,在标题之间显示分隔符,如果显示了,再<tt>bloginfo()</tt>。
This lets you reverse page title and blog name in the title tag from example above ('''Hello world!--My WordPress Blog''') by removing the separator (using <tt>wp_title(' ')</tt>, then tests if there is a post title (using <tt>if(wp_title(' ', false))</tt>), and displays the separator between it and <tt>bloginfo()</tt> if it does.
 
通过移动分隔符(使用<tt>wp_标题(' ')</tt>,然后测试是否存在一个文章标题(使用 <tt>if(wp_标题(' ', 错误的))</tt>),可以颠倒上面的例子中的网页标题和博客名的排列顺序,在标题之间显示分隔符,如果显示了,再<tt>bloginfo()</tt>。


'''对于WordPress2.5版本 – 最新的'''
'''For Wordpress 2.5 - latest'''
<pre><title>
<pre><title>
  <?php wp_title('--',true,'right'); ?>
  <?php wp_title('--',true,'right'); ?>
第53行: 第74行:
  </title></pre>
  </title></pre>


'''对于先前的版本'''
'''For previous versions'''
<pre><title>
<pre><title>
  <?php wp_title(' '); ?>
  <?php wp_title(' '); ?>
第59行: 第80行:
  <?php bloginfo('name'); ?>
  <?php bloginfo('name'); ?>
  </title></pre>
  </title></pre>
'''对于WordPress2.5版本 – 最新的'''
<pre><标题>
<?php wp_标题('--',正确的,'right'); ?>
<?php bloginfo('名称'); ?>
</标题></pre>
'''对于先前的版本'''
<pre><标题>
<?php wp_标题(' '); ?>
<?php 如果(wp_标题(' ',错误的)) { echo '--'; } ?>
<?php bloginfo('名称'); ?>
</标题></pre>
== Parameters ==


== 参数==
== 参数==
; sep : (''string'') Text to display before or after of the post title (i.e. the separator).  By default (if sep is blank) then the &amp;raquo; (&raquo;) symbol will be placed before or after (specified by the '''seplocation''') the post title. 


; sep : (''string'')文章标题之前或者之后显示的文本(例如分隔符)。默认情况下,(如果sep是空白的),那么就是&amp;raquo; (&raquo;)符号会在文章标题之前或者之后显示(由'''seplocation'''规定)。
; sep : (''string'')文章标题之前或者之后显示的文本(例如分隔符)。默认情况下,(如果sep是空白的),那么就是&amp;raquo; (&raquo;)符号会在文章标题之前或者之后显示(由'''seplocation'''规定)。


; echo : (boolean) Echo标题 (True) 或者返回标题作为一个PHP字符串使用 (False). 有效的参数值:
; echo : (boolean) Echo the title (True) or return the title for use as a PHP string (False). Valid values:
 
; echo : (boolean) Echo标题(正确的)或者返回标题作为一个PHP字符串使用(错误的)。有效的参数值:
 
:*<tt>1</tt> (True) - default  
:*<tt>1</tt> (True) - default  
:*<tt>0</tt>: (False)
:*<tt>0</tt>: (False)


; seplocation : (''string'')在2.5版本中引入,这个参数定义了与文章标题相关的'''sep'''字符串放置的位置。拥有除了'right'外所有的参数值,'''sep'''参数值可以放在文章标题的前面(文章标题的左边)。如果seplocation的参数值是'right',那么'''sep'''字符串会附加在文章的后面。
:*<tt>1</tt> (正确的) – 默认的
:*<tt>0</tt>: (错误的)
 
; seplocation : (''string'') Introduced with Version 2.5, this parameter defines the location of where the '''sep''' string prints in relation to the title of the post.  For all values except 'right', the '''sep''' value is placed in front of (to the left of) the post title.  If the value of seplocation is 'right' then the '''sep''' string will be appended after the post title.
 
; seplocation : (''string'')在2.5版本中引入,这个参数定义了与文章标题相关的'''sep'''字符串放置的位置。拥有除了'右边'外所有的参数值,'''sep'''参数值可以放在文章标题的前面(文章标题的左边)。如果seplocation的参数值是'右边的',那么'''sep'''字符串会附加在文章的后面。
 
== Related ==
 
{{Tag General Tags}}
 
{{PHP Function Tag Footer}}


== 相关的==
== 相关的==
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅Wordpress-mediawiki:版权的细节)。 未经许可,请勿提交受版权保护的作品!
取消 编辑帮助(在新窗口中打开)