WordPress: Template Tags/wp list bookmarks:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == This function was introduced in WordPress v2.1 . wp_list_bookmarks(), displays bookmarks found in the [[WordPress:Administr...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述 ==
This function was introduced in WordPress v2.1 . [[WordPress:Template_Tags/wp_list_bookmarks|wp_list_bookmarks()]], displays bookmarks found in the [[WordPress:Administration_Panels|Administration]] > [[WordPress:Administration_Panels#Manage_Blogroll|Blogroll]] > [[WordPress:Manage_Blogroll_SubPanel|Manage Blogroll]] panel.  This [[WordPress:Template_Tags|Template Tag]] allows the user to control how the bookmarks are sorted and displayed and is intended to replace the Template tags '[[WordPress:Template_Tags/get_links_list|get_links_list()]]' and '[[WordPress:Template_Tags/get_links|get_links()]]'.
This function was introduced in WordPress v2.1 . [[WordPress:Template_Tags/wp_list_bookmarks|wp_list_bookmarks()]], displays bookmarks found in the [[WordPress:Administration_Panels|Administration]] > [[WordPress:Administration_Panels#Manage_Blogroll|Blogroll]] > [[WordPress:Manage_Blogroll_SubPanel|Manage Blogroll]] panel.  This [[WordPress:Template_Tags|Template Tag]] allows the user to control how the bookmarks are sorted and displayed and is intended to replace the Template tags '[[WordPress:Template_Tags/get_links_list|get_links_list()]]' and '[[WordPress:Template_Tags/get_links|get_links()]]'.
这个函数是在WordPress2.1版本时,引进的。[[WordPress:Template_Tags/wp_list_bookmarks|wp_list_bookmarks()]],显示[[WordPress:Administration_Panels|管理]] > [[WordPress:Administration_Panels#Manage_Blogroll|友情链接]] > [[WordPress:Manage_Blogroll_SubPanel|管理友情链接]]面板中出现的书签。这个[WordPress:Template_Tags|模板标签]]允许用户控制书签的分类,显示方式,而且试图替换模板标签'[[WordPress:Template_Tags/get_links_list|get_links_list()]]' 和'[[WordPress:Template_Tags/get_links|get_links()]]'。


== Usage ==
== Usage ==
== 用法 ==
%%% <?php wp_list_bookmarks('arguments'); ?> %%%
%%% <?php wp_list_bookmarks('arguments'); ?> %%%
%%% <?php wp_list_bookmarks('arguments'); ?> %%%


第8行: 第19行:


===Default Usage===
===Default Usage===
==例子 ==
===默认用法===
<pre>
$defaults = array(
'orderby' => 'name',
'order' => 'ASC',
'limit' => -1,
'category' => '',
'category_name' => '',
'hide_invisible' => 1,
'show_updated' => 0,
'show_description' => 1,
'echo' => 1,
'categorize' => 1,
'title_li' => __('Bookmarks'),
'title_before' => '<h2>',
'title_after' => '</h2>',
'category_orderby' => 'name',
'category_order' => 'ASC',
'class' => 'linkcat',
'category_before' => '<li id="%id" class="%class">',
'category_after' => '</li>'
);</pre>
<pre>
<pre>
$defaults = array(
$defaults = array(
第31行: 第70行:


By default, the usage shows:
By default, the usage shows:
默认情况下,用法显示:
* Bookmarks divided into Categories with a Category name heading
* Bookmarks divided into Categories with a Category name heading
*Bookmarks分成了拥有类别名的类别。
* All bookmarks included, regardless of Category ID, Category Name, or Category ID
* All bookmarks included, regardless of Category ID, Category Name, or Category ID
*不管类别ID,或者类别名,包含了所有bookmarks
* Sorts the list by name
* Sorts the list by name
*根据名称给列表分类
* An image if one is included
* An image if one is included
*如果包含了图像,就会有一个图像
* A space between the image and the text
* A space between the image and the text
*图像和文本之间拥有一个空格
* Shows the description of the bookmark
* Shows the description of the bookmark
*显示关于bookmark的描述
* Does not show the ratings
* Does not show the ratings
*不显示级别
* Unless limit is set, shows all bookmarks
* Unless limit is set, shows all bookmarks
*除非设置了限制,否则显示所有的bookmarks
* Displays bookmarks  
* Displays bookmarks  
*显示bookmarks


  <?php wp_list_bookmarks(); ?>
  <?php wp_list_bookmarks(); ?>
<?php wp_list_bookmarks(); ?>


=== Simple List ===
=== Simple List ===
=== 简单的列表 ===
Displays all bookmarks with the title "Bookmarks" and with items wrapped in &lt;li&gt; tags. The title is wrapped in h2 tags.
Displays all bookmarks with the title "Bookmarks" and with items wrapped in &lt;li&gt; tags. The title is wrapped in h2 tags.
显示所有的bookmarks,带有标题"Bookmarks",同时将items放入&lt;li&gt;标签。这个标题包裹在h2标签中。


  <?php wp_list_bookmarks('title_li=&category_before=&category_after='); ?>
  <?php wp_list_bookmarks('title_li=&category_before=&category_after='); ?>
<?php wp_list_bookmarks('title_li=&category_before=&category_after='); ?>


=== Simple List without the Heading ===
=== Simple List without the Heading ===
===没有标头的简单列表===
Displays all bookmarks as above, but does not include the default heading.
Displays all bookmarks as above, but does not include the default heading.
如上所述,显示所有的bookmarks,但是不包含默认标头。


  <?php wp_list_bookmarks('title_li=&categorize=0'); ?>
  <?php wp_list_bookmarks('title_li=&categorize=0'); ?>
<?php wp_list_bookmarks('title_li=&categorize=0'); ?>


=== Specific Category Sorted by URL ===
=== Specific Category Sorted by URL ===
=== 根据URL分类的特别的类别 ===
Displays bookmarks for Category ID 2 in span tags, uses images for bookmarks, does not show descriptions, sorts by bookmark URL.  
Displays bookmarks for Category ID 2 in span tags, uses images for bookmarks, does not show descriptions, sorts by bookmark URL.  
在span标签中显示类别ID2的bookmarks,为bookmarks使用图像,不显示描述,根据bookmarkURL分类。


  <?php wp_list_bookmarks('categorize=0&category=2&before=&lt;span&gt;&after=&lt;/span&gt;&show_images=1&show_description=0&orderby=url'); ?>
  <?php wp_list_bookmarks('categorize=0&category=2&before=&lt;span&gt;&after=&lt;/span&gt;&show_images=1&show_description=0&orderby=url'); ?>
<?php wp_list_bookmarks('categorize=0&category=2&before=&lt;span&gt;&after=&lt;/span&gt;&show_images=1&show_description=0&orderby=url'); ?>


=== Shows Ratings and Timestamp ===
=== Shows Ratings and Timestamp ===
=== 显示级别和时间标记 ===
Displays all bookmarks in an ordered list with descriptions on a new line, does not use images for bookmarks, sorts by bookmark id, shows ratings and last-updated timestamp.
Displays all bookmarks in an ordered list with descriptions on a new line, does not use images for bookmarks, sorts by bookmark id, shows ratings and last-updated timestamp.
在一个有序的列表上显示所有的bookmarks,另起一行加上描述,不为bookmarks使用图像,根据bookmark id 分类,显示级别和最后更新的时间。


  &lt;ol&gt;
  &lt;ol&gt;
<?php wp_list_bookmarks('between=&lt;br /&gt;&show_images=0&orderby=id&show_rating=1&show_updated=1'); ?>
&lt;/ol&gt;
&lt;ol&gt;
  <?php wp_list_bookmarks('between=&lt;br /&gt;&show_images=0&orderby=id&show_rating=1&show_updated=1'); ?>
  <?php wp_list_bookmarks('between=&lt;br /&gt;&show_images=0&orderby=id&show_rating=1&show_updated=1'); ?>
  &lt;/ol&gt;
  &lt;/ol&gt;


== Parameters ==
== Parameters ==
== 参数 ==
<!--
<pre>
<!--
<!--
<pre>
<pre>
Default settings for actual function will be deleted upon publication
Default settings for actual function will be deleted upon publication
真正的函数的默认设置,会在发表之时,被删除
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '',
'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1,
'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>',
'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat',
'category_before' => '<li id="%id" class="%class">', 'category_after' => '</li>');
</pre>
-->
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '',
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '',
'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1,
'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1,
第76行: 第189行:
</pre>
</pre>
-->
-->
; categorize : (''boolean'') Bookmarks should be shown within their assigned Categories (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; categorize : (''boolean'') Bookmarks should be shown within their assigned Categories (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
;分类:(''boolean'')Bookmarks必须在指定的类别中显示(<tt>正确的</tt>)或者不必在指定的类别中显示(<tt>错误的</tt>)。默认为<tt>正确的</tt>。
:* <tt>1</tt> (True - default)
:* <tt>1</tt> (True - default)
:* <tt>0</tt> (False)
:* <tt>0</tt> (False)
:* <tt>1</tt> (正确的- 默认)
:* <tt>0</tt> (错误的)
; category : (''string'') Comma separated list of numeric Category IDs to be displayed. If none is specified, all Categories with bookmarks are shown. Defaults to <tt>''</tt> (all Categories).
; category : (''string'') Comma separated list of numeric Category IDs to be displayed. If none is specified, all Categories with bookmarks are shown. Defaults to <tt>''</tt> (all Categories).
;类别:(''string'')用逗号分开列表上将要显示的类别ID。如果没有特别规定,拥有bookmarks的所有类别都会显示。默认为<tt>''</tt>(所有类别)。
; category_name : (''string'') The name of a Category whose bookmarks will be displayed. If none is specified, all Categories with bookmarks are shown. Defaults to <tt>''</tt> (all Categories).
; category_name : (''string'') The name of a Category whose bookmarks will be displayed. If none is specified, all Categories with bookmarks are shown. Defaults to <tt>''</tt> (all Categories).
;category_name : (''string'')将要显示bookmarks的类别的名称。如果没有特别规定,拥有bookmarks的所有的类别都会显示。默认为<tt>''</tt>(所有类别)。
; category_before : (''string'') Text to put before each category. Defaults to <tt>'&lt;li id="[category id]" class="linkcat"&gt;'</tt> .
; category_before : (''string'') Text to put before each category. Defaults to <tt>'&lt;li id="[category id]" class="linkcat"&gt;'</tt> .
; category_before : (''string'')每个类别之前放置的文本。默认为<tt>'&lt;li id="[类别 id]" class="linkcat"&gt;'</tt>。
; category_after : (''string'') Text to put before each category. Defaults to <tt>'&lt;'/li&gt;'</tt> .
; category_after : (''string'') Text to put before each category. Defaults to <tt>'&lt;'/li&gt;'</tt> .
; category_after : (''string'') 每个类别之前放置的文本。默认为<tt>'&lt;'/li&gt;'</tt>。
; class : (''string'') The class each cateogory li will have on it. Defaults to <tt>'linkcat'</tt> .
; class : (''string'') The class each cateogory li will have on it. Defaults to <tt>'linkcat'</tt> .
; class : (''string'')每个类别li从属的class。默认为<tt>'linkcat'</tt>。
; category_orderby : (''string'') Value to sort Categories on. Defaults to <tt>'name'</tt>. Valid options:
; category_orderby : (''string'') Value to sort Categories on. Defaults to <tt>'name'</tt>. Valid options:
; category_orderby : (''string'')给类别分类的参数。默认为<tt>'名称'</tt>。有效的参数值:
:* <tt>'name'</tt> (Default)
:* <tt>'name'</tt> (Default)
:* <tt>'id'</tt>
:* <tt>'id'</tt>
第90行: 第230行:
:* <tt>'count'</tt>
:* <tt>'count'</tt>
:* <tt>'term_group'</tt> (not used yet)
:* <tt>'term_group'</tt> (not used yet)
* <tt>'名称'</tt> (默认)
:* <tt>'id'</tt>
:* <tt>'slug'</tt>
:* <tt>'数目'</tt>
:* <tt>'term_group'</tt> (还没有使用)
; category_order : (''string'') Sort order, ascending or descending for the category_orderby parameter. Valid values:
; category_order : (''string'') Sort order, ascending or descending for the category_orderby parameter. Valid values:
; category_order : (''string'')类别顺序,category_orderby参数升序或者降序。有效的参数值:
:* <tt>ASC</tt> (Default)
:* <tt>ASC</tt> (Default)
:* <tt>DESC</tt>
:* <tt>DESC</tt>
:* <tt>ASC</tt> (默认)
:* <tt>DESC</tt>
; title_li : (''string'') Text for the heading of the links list. Defaults to <tt>'__('Bookmarks')'</tt>, which displays "Bookmarks" (the <tt>__(&#039;&#039;)</tt> is used for [[WordPress:Localization|localization purposes]]).  Only used with categorize set to 0 (else the category names will be used instead). If passed a null (0) value, no heading is displayed, and the list will not be wrapped with <tt>&lt;ul>, &lt;/ul></tt> tags.
; title_li : (''string'') Text for the heading of the links list. Defaults to <tt>'__('Bookmarks')'</tt>, which displays "Bookmarks" (the <tt>__(&#039;&#039;)</tt> is used for [[WordPress:Localization|localization purposes]]).  Only used with categorize set to 0 (else the category names will be used instead). If passed a null (0) value, no heading is displayed, and the list will not be wrapped with <tt>&lt;ul>, &lt;/ul></tt> tags.
; title_li : (''string'')链接列表标头的文本。默认为<tt>'__('Bookmarks')'</tt>,显示"Bookmarks"(<tt>__(&#039;&#039;)</tt>用作[[WordPress:Localization|本地化目的]])。只当类别设置为0的时候,才会使用(否则会使用类别名代替)。如果验证通过了零(0)值,不显示标头,而且列表不会包裹在<tt>&lt;ul>, &lt;/ul></tt>标签内部。
; title_before : (''string'') Text to place before each Category description if 'categorize' is TRUE.  Defaults to <tt>'&lt;h2&gt;'</tt>.
; title_before : (''string'') Text to place before each Category description if 'categorize' is TRUE.  Defaults to <tt>'&lt;h2&gt;'</tt>.
; title_before : (''string'')如果'类别'是正确的,每个类别描述之前放置的文本。默认为<tt>'&lt;h2&gt;'</tt>。
; title_after : (''string'') Text to place after each Category description if 'categorize' is TRUE. Defaults to <tt>'&lt;/h2&gt;'</tt>.
; title_after : (''string'') Text to place after each Category description if 'categorize' is TRUE. Defaults to <tt>'&lt;/h2&gt;'</tt>.
; show_private : (''boolean'') Should a Category be displayed even if the Category is considered private.  Ignore the admin setting and show private Categories (<tt>TRUE</tt>) or do NOT show private Categories (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
 
; title_after : (''string'')如果'类别'是正确的,每个类别描述之后放置的文本。默认为<tt>'&lt;/h2&gt;'</tt>。
 
; show_private : (''boolean'') Should a Category be displayed even if the Category is considered private.  Ignore the admin setting and show private Categories (<tt>TRUE</tt>) or do NOT show private Categories (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.  
;show_private : (''boolean'')如果类别被规定为保密的,类别是否应该显示。忽视管理设置,并且显示保密的类别(<tt>正确的</tt>)还是不显示保密的类别(<tt>错误的</tt>)。默认为<tt>错误的</tt>。
 
 
:* <tt>1</tt> (True)
:* <tt>1</tt> (True)
:* <tt>0</tt> (False - default)
:* <tt>0</tt> (False - default)
:* <tt>1</tt> (正确答)
:* <tt>0</tt> (错误的 – 默认)
; include : (''string'') Comma separated list of numeric bookmark IDs to include in the output.  For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6.  If the include string is used, the ''category'', ''category_name'', and ''exclude'' parameters are ignored.  Defaults to <tt>''</tt> (all Bookmarks).
; include : (''string'') Comma separated list of numeric bookmark IDs to include in the output.  For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6.  If the include string is used, the ''category'', ''category_name'', and ''exclude'' parameters are ignored.  Defaults to <tt>''</tt> (all Bookmarks).
; 包含 : (''string'')用逗号分开列表上的bookmark的ID数字,并且将其包含在输出中。例如,, '包含=1,3,6'指的是返回或者echo bookmark ID1,3,和6。如果使用了包含字符串,便忽视了''类别'', ''category_name'', 和 ''删除''参数。默认为<tt>''</tt>(所有的Bookmarks)。
; exclude : (''string'') Comma separated list of numeric bookmark IDs to exclude.  For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed.  Defaults to <tt>''</tt> (exclude nothing).
; exclude : (''string'') Comma separated list of numeric bookmark IDs to exclude.  For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed.  Defaults to <tt>''</tt> (exclude nothing).
; 删除 : (''string'')删除列表上用逗号分开的bookmark ID 数字。例如,'删除=4,12'指的是bookmark ID 为4和12的bookmark不会返回或者echod。默认为<tt>''</tt>(不删除任何内容)。
; orderby : (''string'') Value to sort bookmarks on. Defaults to <tt>'name'</tt> unless you pass the value of <tt>&#39;&#39;</tt> (empty), in which case it sets to <tt>'id'</tt>. Valid options:
; orderby : (''string'') Value to sort bookmarks on. Defaults to <tt>'name'</tt> unless you pass the value of <tt>&#39;&#39;</tt> (empty), in which case it sets to <tt>'id'</tt>. Valid options:
; orderby : (''string'')给bookmark分类的参数。默认为<tt>'名称'</tt>,除非你验证通过了参数<tt>&#39;&#39;</tt> (空的),在这种情况下,设置为<tt>'id'</tt>。有效的选项:
:* <tt>'id'</tt>
:* <tt>'id'</tt>
:* <tt>'url'</tt>
:* <tt>'url'</tt>
第115行: 第298行:
:* <tt>'length'</tt> - The length of the bookmark name, shortest to longest.   
:* <tt>'length'</tt> - The length of the bookmark name, shortest to longest.   
:* <tt>'rand'</tt> - Display bookmarks in random order.   
:* <tt>'rand'</tt> - Display bookmarks in random order.   
:* <tt>'id'</tt>
:* <tt>'url'</tt>
:* <tt>'名称'</tt>
:* <tt>'目标'</tt>
:* <tt>'描述'</tt>
:* <tt>'用户'</tt> - 通过bookmarks管理器添加bookmark的用户
:* <tt>'等级级别'</tt>
:* <tt>'更新的'</tt>
:* <tt>'rel'</tt> - bookmark关系 (XFN).
:* <tt>'注意'</tt>
:* <tt>'rss'</tt>
:* <tt>'长度'</tt> - bookmark名称的长度,从最短到最长。
:* <tt>'rand'</tt> -以任意的顺序显示bookmarks。 


; order : (''string'') Sort order, ascending or descending for the orderby parameter. Valid values:
; order : (''string'') Sort order, ascending or descending for the orderby parameter. Valid values:
;顺序:(''string'')分类顺序,根据参数的升序或者降序。有效的参数值:
:* <tt>ASC</tt> (Default)
:* <tt>ASC</tt> (Default)
:* <tt>DESC</tt>
:* <tt>DESC</tt>
:* <tt>ASC</tt> (默认)
:* <tt>DESC</tt>
; limit : (''integer'') Maximum number of bookmarks to display. Defaults to <tt>-1</tt> (all bookmarks).
; limit : (''integer'') Maximum number of bookmarks to display. Defaults to <tt>-1</tt> (all bookmarks).
;限制:(''整数'')最多显示的bookmarks的数目。默认为<tt>-1</tt>(所有的bookmarks)。
; before : (''string'') Text to place before each bookmark. Defaults to <tt>'&lt;li&gt;'</tt>.
; before : (''string'') Text to place before each bookmark. Defaults to <tt>'&lt;li&gt;'</tt>.
; 之前 : (''string'')每个bookmark之前放置的文本。默认为<tt>'&lt;li&gt;'</tt>。
; after : (''string'') Text to place after each bookmark. Defaults to <tt>'&lt;/li&gt;'</tt>.
; after : (''string'') Text to place after each bookmark. Defaults to <tt>'&lt;/li&gt;'</tt>.
; 之后: (''string'')每个bookmark之后放置的文本。默认为<tt>'&lt;/li&gt;'</tt>。
; category_before : (''string'') Text to place before each category. Defaults to <tt>'&lt;li&gt;'</tt> with an appropriate id and class.
; category_before : (''string'') Text to place before each category. Defaults to <tt>'&lt;li&gt;'</tt> with an appropriate id and class.
; category_before : (''string'')每个类别之前放置的文本。默认为<tt>'&lt;li&gt;'</tt>,拥有适当的id和class。
; category_after : (''string'') Text to place after each category. Defaults to <tt>'&lt;/li&gt;'</tt>.
; category_after : (''string'') Text to place after each category. Defaults to <tt>'&lt;/li&gt;'</tt>.
; category_after : (''string'')每个类别之后放置的文本。默认为<tt>'&lt;/li&gt;'</tt>。
; between : (''string'') Text to place between each bookmark/image and its description. Defaults to <tt>'\n'</tt> (newline).
; between : (''string'') Text to place between each bookmark/image and its description. Defaults to <tt>'\n'</tt> (newline).
;之间: (''string'')每个bookmark/图像和各自的描述之间放置的文本。默认为<tt>'\n'</tt>(换行)。
; show_images : (''boolean'') Should images for bookmarks be shown (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; show_images : (''boolean'') Should images for bookmarks be shown (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; show_images : (''boolean'')关于bookmarks的图像应该显示(<tt>正确的</tt>) 或者不显示(<tt>错误的</tt>)。默认为<tt>正确的</tt>。
:* <tt>1</tt> (True - default)
:* <tt>1</tt> (True - default)
:* <tt>0</tt> (False)
:* <tt>0</tt> (False)
:* <tt>1</tt> (正确的 – 默认)
:* <tt>0</tt> (错误的)
; show_description : (''boolean'') Should the description be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Valid when '''show_images''' is <tt>FALSE</tt>, or an image is not defined. Defaults to <tt>FALSE</tt>.
; show_description : (''boolean'') Should the description be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Valid when '''show_images''' is <tt>FALSE</tt>, or an image is not defined. Defaults to <tt>FALSE</tt>.
; show_description : (''boolean'')描述应该显示(<tt>正确的</tt>) 或者不应该显示 (<tt>错误的</tt>)。当'''show_images'''是<tt>错误的</tt>,或者没有定义一个图像的时候,是有效的。默认为<tt>错误的</tt>。
:* <tt>1</tt> (True)
:* <tt>1</tt> (True)
:* <tt>0</tt> (False - default)
:* <tt>0</tt> (False - default)
:* <tt>1</tt> (正确的)
:* <tt>0</tt> (错误的 – 默认)
; show_rating : (''boolean'') Should rating stars/characters be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
; show_rating : (''boolean'') Should rating stars/characters be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
; show_rating : (''boolean'')等级级别stars/字符应该显示(<tt>正确的</tt>)或者不应该显示 (<tt>错误的</tt>)。默认为<tt>错误的</tt>。
:* <tt>1</tt> (True)
:* <tt>1</tt> (True)
:* <tt>0</tt> (False - default)
:* <tt>0</tt> (False - default)
:* <tt>1</tt> (正确的)
:* <tt>0</tt> (错误的 – 默认)
; show_updated : (''boolean'') Should the last updated timestamp be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
; show_updated : (''boolean'') Should the last updated timestamp be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>FALSE</tt>.
; show_updated : (''boolean'')最后更新的时间应该显示(<tt>正确的</tt>)或者不应该显示 (<tt>错误的</tt>)。默认为<tt>错误的</tt>。
:* <tt>1</tt> (True)
:* <tt>1</tt> (True)
:* <tt>0</tt> (False - default)
:* <tt>0</tt> (False - default)
:* <tt>1</tt> (正确的)
:* <tt>0</tt> (错误的 – 默认)
; hide_invisible : (''boolean'') Should bookmark be displayed even if it's Visible setting is No.  Abides by admin setting (<tt>TRUE</tt>) or does no abide by admin setting (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; hide_invisible : (''boolean'') Should bookmark be displayed even if it's Visible setting is No.  Abides by admin setting (<tt>TRUE</tt>) or does no abide by admin setting (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; 隐藏_看不见的 : (''boolean'')即时bookmark的可视设置为否定的,也应该显示这个bookmark,遵从管理设置(<tt>正确的</tt>)或者不遵从管理设置(<tt>错误的</tt>)。默认为<tt>正确的</tt>。
:* <tt>1</tt> (True - default)
:* <tt>1</tt> (True - default)
:* <tt>0</tt> (False)
:* <tt>0</tt> (False)
第143行: 第412行:
:* <tt>1</tt> (True - default)
:* <tt>1</tt> (True - default)
:* <tt>0</tt> (False)
:* <tt>0</tt> (False)
:* <tt>1</tt> (正确的 – 默认)
:* <tt>0</tt> (错误的)
; echo : (''boolean'') 显示 bookmarks (<tt>正确的</tt>) 或者返回bookmarks,供PHP使用(<tt>错误的</tt>)。默认为<tt>正确的</tt>。
:* <tt>1</tt> (正确的- 默认)
:* <tt>0</tt> (错误的)


== Related ==
== Related ==
第149行: 第426行:


{{PHP Function Tag Footer}}
{{PHP Function Tag Footer}}
== 相关的==
{{标签bookmark管理器标签}}
{{PHP函数标签页底文字}}

2008年7月8日 (二) 17:21的版本

Description

描述

This function was introduced in WordPress v2.1 . wp_list_bookmarks(), displays bookmarks found in the Administration > Blogroll > Manage Blogroll panel. This Template Tag allows the user to control how the bookmarks are sorted and displayed and is intended to replace the Template tags 'get_links_list()' and 'get_links()'.

这个函数是在WordPress2.1版本时,引进的。wp_list_bookmarks(),显示管理 > 友情链接 > 管理友情链接面板中出现的书签。这个[WordPress:Template_Tags|模板标签]]允许用户控制书签的分类,显示方式,而且试图替换模板标签'get_links_list()' 和'get_links()'。

Usage

用法

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

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

Examples

Default Usage

例子

默认用法

$defaults = array(
'orderby' => 'name',
'order' => 'ASC',
'limit' => -1,
'category' => '',
'category_name' => '',
'hide_invisible' => 1,
'show_updated' => 0,
'show_description' => 1,
'echo' => 1,
'categorize' => 1,
'title_li' => __('Bookmarks'),
'title_before' => '<h2>',
'title_after' => '</h2>',
'category_orderby' => 'name',
'category_order' => 'ASC',
'class' => 'linkcat',
'category_before' => '<li id="%id" class="%class">',
'category_after' => '</li>'
);


$defaults = array(
'orderby' => 'name',
'order' => 'ASC',
'limit' => -1,
'category' => '',
'category_name' => '',
'hide_invisible' => 1,
'show_updated' => 0,
'show_description' => 1,
'echo' => 1,
'categorize' => 1,
'title_li' => __('Bookmarks'),
'title_before' => '<h2>',
'title_after' => '</h2>',
'category_orderby' => 'name',
'category_order' => 'ASC',
'class' => 'linkcat',
'category_before' => '<li id="%id" class="%class">',
'category_after' => '</li>'
);

By default, the usage shows:

默认情况下,用法显示:

  • Bookmarks divided into Categories with a Category name heading
  • Bookmarks分成了拥有类别名的类别。
  • All bookmarks included, regardless of Category ID, Category Name, or Category ID
  • 不管类别ID,或者类别名,包含了所有bookmarks
  • Sorts the list by name
  • 根据名称给列表分类
  • An image if one is included
  • 如果包含了图像,就会有一个图像
  • A space between the image and the text
  • 图像和文本之间拥有一个空格
  • Shows the description of the bookmark
  • 显示关于bookmark的描述
  • Does not show the ratings
  • 不显示级别
  • Unless limit is set, shows all bookmarks
  • 除非设置了限制,否则显示所有的bookmarks
  • Displays bookmarks
  • 显示bookmarks
<?php wp_list_bookmarks(); ?>

<?php wp_list_bookmarks(); ?>

Simple List

简单的列表

Displays all bookmarks with the title "Bookmarks" and with items wrapped in <li> tags. The title is wrapped in h2 tags.

显示所有的bookmarks,带有标题"Bookmarks",同时将items放入<li>标签。这个标题包裹在h2标签中。

<?php wp_list_bookmarks('title_li=&category_before=&category_after='); ?>

<?php wp_list_bookmarks('title_li=&category_before=&category_after='); ?>

Simple List without the Heading

没有标头的简单列表

Displays all bookmarks as above, but does not include the default heading.

如上所述,显示所有的bookmarks,但是不包含默认标头。

<?php wp_list_bookmarks('title_li=&categorize=0'); ?>

<?php wp_list_bookmarks('title_li=&categorize=0'); ?>

Specific Category Sorted by URL

根据URL分类的特别的类别

Displays bookmarks for Category ID 2 in span tags, uses images for bookmarks, does not show descriptions, sorts by bookmark URL.

在span标签中显示类别ID2的bookmarks,为bookmarks使用图像,不显示描述,根据bookmarkURL分类。

<?php wp_list_bookmarks('categorize=0&category=2&before=<span>&after=</span>&show_images=1&show_description=0&orderby=url'); ?>

<?php wp_list_bookmarks('categorize=0&category=2&before=<span>&after=</span>&show_images=1&show_description=0&orderby=url'); ?>

Shows Ratings and Timestamp

显示级别和时间标记

Displays all bookmarks in an ordered list with descriptions on a new line, does not use images for bookmarks, sorts by bookmark id, shows ratings and last-updated timestamp.

在一个有序的列表上显示所有的bookmarks,另起一行加上描述,不为bookmarks使用图像,根据bookmark id 分类,显示级别和最后更新的时间。

<ol>
<?php wp_list_bookmarks('between=<br />&show_images=0&orderby=id&show_rating=1&show_updated=1'); ?>
</ol>

<ol>

<?php wp_list_bookmarks('between=<br />&show_images=0&orderby=id&show_rating=1&show_updated=1'); ?>
</ol>

Parameters

参数

$defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => , 'category_name' => , 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1,

'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '

', 'title_after' => '

',

'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat',

'category_before' => '

  • ', 'category_after' => '
  • ');

    -->

    categorize
    (boolean) Bookmarks should be shown within their assigned Categories (TRUE) or not (FALSE). Defaults to TRUE.

    ;分类:(boolean)Bookmarks必须在指定的类别中显示(正确的)或者不必在指定的类别中显示(错误的)。默认为正确的

    • 1 (True - default)
    • 0 (False)
    • 1 (正确的- 默认)
    • 0 (错误的)


    category
    (string) Comma separated list of numeric Category IDs to be displayed. If none is specified, all Categories with bookmarks are shown. Defaults to (all Categories).

    ;类别:(string)用逗号分开列表上将要显示的类别ID。如果没有特别规定,拥有bookmarks的所有类别都会显示。默认为(所有类别)。

    category_name
    (string) The name of a Category whose bookmarks will be displayed. If none is specified, all Categories with bookmarks are shown. Defaults to (all Categories).

    ;category_name : (string)将要显示bookmarks的类别的名称。如果没有特别规定,拥有bookmarks的所有的类别都会显示。默认为(所有类别)。

    category_before
    (string) Text to put before each category. Defaults to '<li id="[category id]" class="linkcat">' .
    category_before
    (string)每个类别之前放置的文本。默认为'<li id="[类别 id]" class="linkcat">'
    category_after
    (string) Text to put before each category. Defaults to '<'/li>' .
    category_after
    (string) 每个类别之前放置的文本。默认为'<'/li>'
    class
    (string) The class each cateogory li will have on it. Defaults to 'linkcat' .
    class
    (string)每个类别li从属的class。默认为'linkcat'
    category_orderby
    (string) Value to sort Categories on. Defaults to 'name'. Valid options:
    category_orderby
    (string)给类别分类的参数。默认为'名称'。有效的参数值:
    • 'name' (Default)
    • 'id'
    • 'slug'
    • 'count'
    • 'term_group' (not used yet)
    • '名称' (默认)
    • 'id'
    • 'slug'
    • '数目'
    • 'term_group' (还没有使用)


    category_order
    (string) Sort order, ascending or descending for the category_orderby parameter. Valid values:
    category_order
    (string)类别顺序,category_orderby参数升序或者降序。有效的参数值:
    • ASC (Default)
    • DESC


    • ASC (默认)
    • DESC


    title_li
    (string) Text for the heading of the links list. Defaults to '__('Bookmarks')', which displays "Bookmarks" (the __('') is used for localization purposes). Only used with categorize set to 0 (else the category names will be used instead). If passed a null (0) value, no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags.
    title_li
    (string)链接列表标头的文本。默认为'__('Bookmarks')',显示"Bookmarks"(__('')用作本地化目的)。只当类别设置为0的时候,才会使用(否则会使用类别名代替)。如果验证通过了零(0)值,不显示标头,而且列表不会包裹在<ul>, </ul>标签内部。
    title_before
    (string) Text to place before each Category description if 'categorize' is TRUE. Defaults to '<h2>'.
    title_before
    (string)如果'类别'是正确的,每个类别描述之前放置的文本。默认为'<h2>'
    title_after
    (string) Text to place after each Category description if 'categorize' is TRUE. Defaults to '</h2>'.
    title_after
    (string)如果'类别'是正确的,每个类别描述之后放置的文本。默认为'</h2>'
    show_private
    (boolean) Should a Category be displayed even if the Category is considered private. Ignore the admin setting and show private Categories (TRUE) or do NOT show private Categories (FALSE). Defaults to FALSE.

    ;show_private : (boolean)如果类别被规定为保密的,类别是否应该显示。忽视管理设置,并且显示保密的类别(正确的)还是不显示保密的类别(错误的)。默认为错误的


    • 1 (True)
    • 0 (False - default)
    • 1 (正确答)
    • 0 (错误的 – 默认)
    include
    (string) Comma separated list of numeric bookmark IDs to include in the output. For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6. If the include string is used, the category, category_name, and exclude parameters are ignored. Defaults to (all Bookmarks).
    包含
    (string)用逗号分开列表上的bookmark的ID数字,并且将其包含在输出中。例如,, '包含=1,3,6'指的是返回或者echo bookmark ID1,3,和6。如果使用了包含字符串,便忽视了类别, category_name, 和 删除参数。默认为(所有的Bookmarks)。
    exclude
    (string) Comma separated list of numeric bookmark IDs to exclude. For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed. Defaults to (exclude nothing).
    删除
    (string)删除列表上用逗号分开的bookmark ID 数字。例如,'删除=4,12'指的是bookmark ID 为4和12的bookmark不会返回或者echod。默认为(不删除任何内容)。
    orderby
    (string) Value to sort bookmarks on. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'. Valid options:
    orderby
    (string)给bookmark分类的参数。默认为'名称',除非你验证通过了参数'' (空的),在这种情况下,设置为'id'。有效的选项:
    • 'id'
    • 'url'
    • 'name'
    • 'target'
    • 'description'
    • 'owner' - User who added bookmark through bookmarks Manager.
    • 'rating'
    • 'updated'
    • 'rel' - bookmark relationship (XFN).
    • 'notes'
    • 'rss'
    • 'length' - The length of the bookmark name, shortest to longest.
    • 'rand' - Display bookmarks in random order.



    • 'id'
    • 'url'
    • '名称'
    • '目标'
    • '描述'
    • '用户' - 通过bookmarks管理器添加bookmark的用户
    • '等级级别'
    • '更新的'
    • 'rel' - bookmark关系 (XFN).
    • '注意'
    • 'rss'
    • '长度' - bookmark名称的长度,从最短到最长。
    • 'rand' -以任意的顺序显示bookmarks。





    order
    (string) Sort order, ascending or descending for the orderby parameter. Valid values:

    ;顺序:(string)分类顺序,根据参数的升序或者降序。有效的参数值:

    • ASC (Default)
    • DESC
    • ASC (默认)
    • DESC
    limit
    (integer) Maximum number of bookmarks to display. Defaults to -1 (all bookmarks).

    ;限制:(整数)最多显示的bookmarks的数目。默认为-1(所有的bookmarks)。

    before
    (string) Text to place before each bookmark. Defaults to '<li>'.
    之前
    (string)每个bookmark之前放置的文本。默认为'<li>'
    after
    (string) Text to place after each bookmark. Defaults to '</li>'.
    之后
    (string)每个bookmark之后放置的文本。默认为'</li>'
    category_before
    (string) Text to place before each category. Defaults to '<li>' with an appropriate id and class.
    category_before
    (string)每个类别之前放置的文本。默认为'<li>',拥有适当的id和class。
    category_after
    (string) Text to place after each category. Defaults to '</li>'.
    category_after
    (string)每个类别之后放置的文本。默认为'</li>'
    between
    (string) Text to place between each bookmark/image and its description. Defaults to '\n' (newline).

    ;之间: (string)每个bookmark/图像和各自的描述之间放置的文本。默认为'\n'(换行)。

    show_images
    (boolean) Should images for bookmarks be shown (TRUE) or not (FALSE). Defaults to TRUE.
    show_images
    (boolean)关于bookmarks的图像应该显示(正确的) 或者不显示(错误的)。默认为正确的
    • 1 (True - default)
    • 0 (False)
    • 1 (正确的 – 默认)
    • 0 (错误的)


    show_description
    (boolean) Should the description be displayed (TRUE) or not (FALSE). Valid when show_images is FALSE, or an image is not defined. Defaults to FALSE.
    show_description
    (boolean)描述应该显示(正确的) 或者不应该显示 (错误的)。当show_images错误的,或者没有定义一个图像的时候,是有效的。默认为错误的
    • 1 (True)
    • 0 (False - default)


    • 1 (正确的)
    • 0 (错误的 – 默认)


    show_rating
    (boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE.
    show_rating
    (boolean)等级级别stars/字符应该显示(正确的)或者不应该显示 (错误的)。默认为错误的
    • 1 (True)
    • 0 (False - default)
    • 1 (正确的)
    • 0 (错误的 – 默认)


    show_updated
    (boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE.
    show_updated
    (boolean)最后更新的时间应该显示(正确的)或者不应该显示 (错误的)。默认为错误的
    • 1 (True)
    • 0 (False - default)


    • 1 (正确的)
    • 0 (错误的 – 默认)


    hide_invisible
    (boolean) Should bookmark be displayed even if it's Visible setting is No. Abides by admin setting (TRUE) or does no abide by admin setting (FALSE). Defaults to TRUE.
    隐藏_看不见的
    (boolean)即时bookmark的可视设置为否定的,也应该显示这个bookmark,遵从管理设置(正确的)或者不遵从管理设置(错误的)。默认为正确的
    • 1 (True - default)
    • 0 (False)
    echo
    (boolean) Display bookmarks (TRUE) or return them for use by PHP (FALSE). Defaults to TRUE.
    • 1 (True - default)
    • 0 (False)


    • 1 (正确的 – 默认)
    • 0 (错误的)
    echo
    (boolean) 显示 bookmarks (正确的) 或者返回bookmarks,供PHP使用(错误的)。默认为正确的
    • 1 (正确的- 默认)
    • 0 (错误的)

    Related

    模板:Tag bookmark Manager Tags

    模板:PHP Function Tag Footer

    相关的

    模板:标签bookmark管理器标签