WordPress:Template Tags/wp list bookmarks

来自站长百科
Fludlen讨论 | 贡献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管理器标签