wp_list_bookmarks

Sponsored Link

ブックマークを表示するには、管理画面>リンクパネルから探します。
このテンプレートタグは、ユーザーがどのようにブックマークがソートされて表示さを制御することができます。
このテンプレートタグは、ユーザーがブックマークがどのように分類されて、表示されるかについてを管理することができます。

注:wp_list_bookmarks()は、非推奨になったテンプレートタグ、get_links_list() と get_links()に代わる存在として開発されたものです。

Sponsored Link

Displays bookmarks found in the Administration > Links panel. This Template Tag allows the user to control how the bookmarks are sorted and displayed.

NOTE: wp_list_bookmarks() intended to replace the deprecated Template tags get_links_list() and get_links().

wp_list_bookmarksのテンプレートタグ使用方法

 <?php wp_list_bookmarks( $args ); ?> 

デフォルトの使い方

<?php $args = array(
    'orderby'          => 'name',
    'order'            => 'ASC',
    'limit'            => -1,
    'category'         => ,
    'exclude_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>' ); ?> 

デフォルトでは、関数を表示します:

By default, the function shows:

  • カテゴリー名の見出しでカテゴリーに分けられるブックマーク
  • Category NameまたはCategory IDに関係なく、すべてのブックマークを含みます
  • 名前でリストを分類します
  • 画像が含まれていた場合
  • イメージとテキストの間のスペース
  • ブックマークの説明を表示します
  • 評価を示しません
  • 制限されない限り、全てのブックマークを表示
  • ブックマークを表示

* Bookmarks divided into Categories with a Category name heading
* All bookmarks included, regardless of Category Name or Category ID
* 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
* Does not show the ratings
* Unless limit is set, shows all bookmarks
* Displays bookmarks

wp_list_bookmarks のパラメーター

categorize

(boolean)ブックマークは、割り当てられたカテゴリーの中で表示されなければなりません。

(boolean) Bookmarks should be shown within their assigned Categories or not.

  • 1 (True) – Default
  • 0 (False)

category

(string) カンマによって区切られたカテゴリーIDの数字のリストが表示
されます。何も指定しない場合は、ブックマークを持つすべてのカテゴリが表示されます。デフォルト(すべてのカテゴリ)。

(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).

exclude_category

(string) カンマによって区切られたカテゴリーIDの数字のリストによって表示から除外されるでしょう。デフォルトはそうします(除外されるカテゴリーでない)

(string) Comma separated list of numeric Category IDs to be excluded from display. Defaults to (no categories excluded).

category_name

(string)ブックマークが表示されるカテゴリー名。何も指定されないならば、ブックマークによるすべてのカテゴリーは表示されます。デフォルトは、そうします(すべてのカテゴリー)。

(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_before

(string)テキストは、各カテゴリーの前に配置する。デフォルトは、’

  • ‘です。

    (string) Text to put before each category. Defaults to ‘

  • ‘ .
  • category_after

    (string)テキストは、各カテゴリーの後に配置する。デフォルトは、’

  • (string) Text to put before each category. Defaults to ‘

    ‘ .

    class

    (string)各カテゴリーのliのクラスになります。デフォルトは、’linkcat’です。

    (string) The class each category li will have on it. Defaults to ‘linkcat’ . (This parameter was added with Version 2.2)

    category_orderby

    (string)値にカテゴリを並べ替えます。有効なオプション:

    (string) Value to sort Categories on. Valid options:

    • ‘name’ – Default
    • ‘id’
    • ‘slug’
    • ‘count’
    • ‘term_group’ (not used yet)

    category_order

    (string)category_orderbyパラメーターによって、昇順、降順のソート順が決まります。有効な価値:

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

    • ASC – Default
    • DESC

    title_li

    (string) テキストリンクのリスト見出しです。デフォルトは、’__(‘Bookmarks’)で、”Bookmarks”として表示されます(the __(”)は、ローカライズのために使用されます)。カテゴリーが0 [false]と設定された時のみ使用されます(他にカテゴリー名が代わりに使用されます)。もし’title_li’の値がnull (0)で設定されていた場合、見出しは表示されません。そして、リストは

      ,

    タグで囲まれないでしょう(0 [false]は、このオプションに分類オプションを渡すために必ず有効になります)。

    (string) Text for the heading of the links list. Defaults to ‘__(‘Bookmarks’)’, which displays “Bookmarks” (the __(”) is used for localization purposes). Only used when categorize are set to 0 [false] (else the category names will be used instead). If ‘title_li’ is set to null (0) value, no heading is displayed, and the list will not be wrapped with

      ,

    tags (be sure to pass the categorize option to 0 [false] to this option takes effect).

    title_before

    (string)’categorize’が1 [true]の場合、テキストは各カテゴリーの説明の前に配置する。あるいは、’categorize’が0 [false]だった場合、テキストは”title_li”に定義されます。デフォルトは、’

    ‘です。

    (string) Text to place before each Category description if ‘categorize’ is 1 [true], or text defined in “title_li” if ‘categorize’ is 0 [false]. Defaults to ‘

    ‘.

    title_after

    (string)’categorize’が1 [true]の場合、テキストは各カテゴリーの説明の後に配置する。あるいは、’categorize’が0 [false]だった場合、テキストは”title_li”に定義されます。デフォルトは、’

    ‘です。

    (string) Text to place after each Category description if ‘categorize’ is 1 [true], or text defined in “title_li” if ‘categorize’ is 0 [false]. Defaults to ‘

    ‘.

    show_private

    (boolean) たとえカテゴリーがプライベートと見なされている場合でも、カテゴリーは表示されます。プライベートカテゴリーが(TRUE)の場合は表示し、プライベートカテゴリーが(FALSE)の場合は表示しませんと、管理者の設定を無視することができます。

    (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).

    • 1 (True)
    • 0 (False) – Default

    include

    (string)数値のブックマークIDのコンマで区切られたリストを、出力に含めます。たとえば、 ‘include=1,3,6’は、ブックマークIDの1,3と6をエコーとして返すことを意味します。
    またはブックマークをエコーのID 1、3、6意味が含まれます。文字列を含める場合は、the category、category_nameと除外されたパラメーターは無視されます。デフォルト(すべてのブックマーク)。

    (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).

    exclude

    (string)数値のブックマークIDのコンマで区切られたリストを、出力から除外します。たとえば、’exclude=4,12’はブックマークID4と12を返さない事を意味します。デフォルト(何も除外しない)。

    (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).

    orderby

    (string) ブックマークを分類する値。これは、COMMAで区切られたリストの値にすることができます。デフォルトが’name’でない限り、’id’に設定した場合の” (empty)の値として渡す。

    (string) Value to sort bookmarks on. This can be a COMMA separated list of values. Defaults to ‘name’ unless you pass the value of ” (empty), in which case it sets to ‘id’. Valid options:

    • ‘id’
    • ‘url’
    • ‘name’ – Default
    • ‘target’
    • ‘description’
    • ‘owner’ – ユーザーのブックマークマネージャを介してブックマークを追加しました。
    • ‘rating’
    • ‘updated’ 注:link_updatedフィールドには、ローカルの変更を追跡していません。これは、pingomaticへのリモート要求を介して更新されているリンクポイントを何でも追跡します。
    • ‘rel’ – ブックマークの関係 (XFN).
    • ‘notes’
    • ‘rss’
    • ‘length’ – 最長最短へのブックマーク名の長さ。
    • ‘rand’ – ランダムな順番でブックマークを表示。

    * ‘id’
    * ‘url’
    * ‘name’ – Default
    * ‘target’
    * ‘description’
    * ‘owner’ – User who added bookmark through bookmarks Manager.
    * ‘rating’
    * ‘updated’ Note: the link_updated field does not track local modifications. It tracks when whatever the link points to is updated via remote requests to pingomatic.
    * ‘rel’ – bookmark relationship (XFN).
    * ‘notes’
    * ‘rss’
    * ‘length’ – The length of the bookmark name, shortest to longest.
    * ‘rand’ – Display bookmarks in random order.

    order

    (string)ブックマークは、’orderby’パラメーターで定義されたソート順、昇順または降順で表示されます。有効な値:

    (string) Bookmarks display sorting order, ascending or descending as defined in the ‘orderby’ parameter. Valid values:

    • ASC – Default
    • DESC

    limit

    (integer)ブックマークを表示する最大数です。デフォルトは、-1(すべてのブックマーク)です。

    (integer) Maximum number of bookmarks to display. Default is -1 (all bookmarks).

    before

    (string)各ブックマークの前に配置するテキストです。デフォルトは、’

  • ‘です。

    (string) Text to place before each bookmark. Defaults to ‘

  • ‘.

  • after

    (string)各ブックマークの後に配置するテキストです。デフォルトは、’

  • ‘です。

    (string) Text to place after each bookmark. Defaults to ‘

  • ‘.

    link_before

    (string)ハイパーリンクのコード内の、各ブックマークの前にテキストが配置されます。デフォルトではセットされません。 (このパラメータは、バージョン2.7で追加されました)

    (string) Text to place before the text of each bookmark, inside the hyperlink code. There is no set default. (This parameter was added with Version 2.7)

    link_after

    (string)ハイパーリンクのコード内の、各ブックマークの後にテキストが配置されます。デフォルトではセットされません。 (このパラメータは、バージョン2.7で追加されました)

    (string) Text to place after the text of each bookmark. There is no set default. (This parameter was added with Version 2.7)

    category_before

    (string)各カテゴリーの前に配置するためのテキストです。デフォルトはidとclassに適切な’

  • ‘です。

    (string) Text to place before each category. Defaults to ‘

  • ‘ with an appropriate id and class.
  • category_after

    (string)各カテゴリーの後に配置するためのテキストです。デフォルトはidとclassに適切な’

  • ‘です。

    (string) Text to place after each category. Defaults to ‘

    ‘.

    between

    (string)各ブックマーク/画像とカテゴリー説明の間に配置するテキストです。デフォルトは、’\n’ (改行)です。

    (string) Text to place between each bookmark/image and its description. Defaults to ‘\n’ (newline).

    show_images

    (boolean)ブックマークの画像を(TRUE)で表示するか(FALSE)で表示しないか。

    (boolean) Should images for bookmarks be shown (TRUE) or not (FALSE).

    • 1 (True) – Default
    • 0 (False)

    show_description

    説明を(TRUE)で表示するか(FALSE)で表示しないか。show_imagesがFALSEで有効なとき、画像は定義されません。

    (boolean) Should the description be displayed (TRUE) or not (FALSE). Valid when show_images is FALSE, or an image is not defined.

    • 1 (True)
    • 0 (False) – Default

    show_name

    (boolean) (TRUE)の時、リンクのテキストが表示されます。show_imagesが(TRUE)の時、動作します。 (このパラメーターは、バージョン2.7で追加されました)

    (boolean) Displays the text of a link when (TRUE). Works when show_images is TRUE. (This parameter was added with Version 2.7)

    • 1 (True)
    • 0 (False) – Default

    show_rating

    (boolean)評価スター/文字が(TRUE)の場合表示し、(FALSE)の場合は表示しません。

    (boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE).

    • 1 (True)
    • 0 (False) – Default

    show_updated

    (boolean)最終更新したタイムスタンプが(TRUE)の場合表示し、(FALSE)の場合は表示しません。link_updatedはローカルの変更を追跡しませんことに注意してください。リンクポイントのpingomaticへのリモート要求を介して更新されて追跡します。

    (boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Note that link_updated does not track local modifications. It tracks when whatever the link points to is updated via remote requests to pingomatic.

    • 1 (True)
    • 0 (False) – Default

    hide_invisible

    (boolean)たとえブックマークは表示設定をNoにしてもブックマークは表示されるでしょう。管理者の設定を(TRUE) にして順守するか、管理者の設定を(FALSE)することにより順守しません。

    (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).

    • 1 (True) – Default
    • 0 (False)

    echo

    (boolean)表示のブックマーク(TRUE)やPHP(FALSE)で使用するために値を返します。

    (boolean) Display bookmarks (TRUE) or return them for use by PHP (FALSE).

    • 1 (True) – Default
    • 0 (False)

    シンプルなリストを表示する方法

    “Bookmarks”タイトルと共に、

  • タグに囲まれてアイテムと共に全てのブックマークを表示します。タイトルは、h2タグに囲まれています。

    Displays all bookmarks with the title “Bookmarks” and with items wrapped in

  • tags. The title is wrapped in h2 tags.
  • <?php wp_list_bookmarks('title_li=&amp;category_before=&amp;category_after='); ?>

    見出しを表示しないシンプルなリスト表示方法

    上記のように、すべてブックマークのまま表示されますが、デフォルトの見出しはインクルードされません。

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

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

    URLによって分類される特定のカテゴリー

    カテゴリーIDの2は、spanタグに囲まれ、ブックマークに対する画像が使われ、説明は表示されず、ブックマックURLによってソートされてブックマークが表示されます。

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

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

    評価とタイムスタンプを表示する方法

    改行で説明と共に順序付きリストに全てのブックマークを表示され、ブックマークに画像を使わない、ブックマークIDによってソート、評価を表示してtimestampを最終更新します。

    (最終更新されたタイムスタンプがローカルの変更を追跡しないことに注意してください。pingomaticへのリモート要求を介して更新されているリンクポイントを何でも追跡します)

    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 (Note that the last updated timestamp does not track local modifications. It tracks when whatever the link points to is updated via remote requests to pingomatic.)

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

    画像を見出しとして表示する方法

    普通のテキストの代わりにテーマフォルダから画像を使う方法です。

    Uses an image from the theme folder instead of plain text.

    <?php wp_list_bookmarks('categorize=0&amp;title_li=<img src="'.get_bloginfo("stylesheet_directory").'/images/blogroll.gif" alt="blogroll" />'); ?>

    変更ログ

    * Since: 2.1.0
    * 2.2.0 : Added the class parameter.
    * 2.7.0 : Added the link_before, link_after and show_name

    ソースファイル

    wp_list_bookmarks()は、wp-includes/bookmark-template.php内に位置しています。

    wp_list_bookmarks() is located in wp-includes/bookmark-template.php.

    関連テンプレートタグ

    wp_list_bookmarks, get_bookmarks, get_bookmark, get_bookmark_field

    wp_list_authors, wp_list_categories, wp_list_pages, wp_list_bookmarks, wp_list_comments, wp_get_archives, wp_page_menu, wp_dropdown_pages, wp_dropdown_categories, wp_dropdown_users

    Sponsored Link