WordPress:Template Tags/wp get linksbyname

来自站长百科
Xxf3325讨论 | 贡献2008年6月27日 (五) 10:38的版本 (新页面: {{Deprecated}} == Description == Displays links associated with the named link category. This tag uses the settings you specify in the WordPress:Links Manager. For control over the...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

模板:Deprecated

Description

Displays links associated with the named link category. This tag uses the settings you specify in the WordPress:Links Manager. For control over the formatting and display of your links within the tag's parameters, see get_linksbyname().

Replace With

wp_list_bookmarks().

Usage

%%% <?php wp_get_linksbyname('category','arguments'); ?> %%%

Examples

Default Usage

By default, the tag shows:

  • All categories if none are specified
  • All category links are shown
  • Puts a line break after the link item
  • Puts a space between the image and link (if one is included)
  • Shows link images if available
  • List sorted by ID
  • Shows the link description
  • Does not show the rating
  • With no limit listed, it shows all links
  • Does not show the updated timestamp
<?php wp_get_linksbyname(); ?>

List all links in the Link Category called "Favorites".

<?php wp_get_linksbyname('Favorites') ?>

List all links in the Link Category Blogroll, order the links by name, don't show the description, and show last update timestamp.

<?php wp_get_linksbyname('Blogroll','orderby=name&show_description=0&show_updated=1') ?>

Parameters

category

category
(string) The name of the category whose links will be displayed. No default.

arguments

before
(string) Text to place before each link. There is no default.
after
(string) Text to place after each link. Defaults to '<br />'.
between
(string) Text to place between each link/image and its description. Defaults to ' ' (space).
show_images
(boolean) Should images for links be shown.
  • 1 (True - default)
  • 0 (False)
orderby
(string) Value to sort links on. Valid options:
  • 'id' (default)
  • 'url'
  • 'name'
  • 'target'
  • 'category'
  • 'description'
  • 'owner' - User who added link through Links Manager.
  • 'rating'
  • 'updated'
  • 'rel' - Link relationship (XFN).
  • 'notes'
  • 'rss'
  • 'length' - The length of the link name, shortest to longest.
Prefixing any of the above options with an underscore (ex: '_id') sorts links in reverse order.
  • 'rand' - Display links in random order.
show_description
(boolean) Display the description. Valid if show_images is FALSE or an image is not defined.
  • 1 (True - default)
  • 0 (False)
show_rating
(boolean) Should rating stars/characters be displayed.
  • 1 (True)
  • 0 (False - default)
limit
(integer) Maximum number of links to display. Defaults to -1 (all links).
show_updated
(boolean) Should the last updated timestamp be displayed.
  • 1 (True)
  • 0 (False - default)
echo
(boolean) Display the Links list (1 - true) or return the list to be used in PHP (0 - false). Defaults to 1.
  • 1 (True - default)
  • 0 (False)

Related

模板:Tag Link Manager Tags

模板:Tag Footer