Function Reference/wp get linksbyname

来自WordPress中文文档
跳转至: 导航搜索

wordpress.org.cn


includeonlydiv style=clear:both; background-color:#FFFFFF; border:1px solid #FFFFFF; color:#c00; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also onlyincludecodewp-includes/deprecated.php/code/onlyinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Template Description

Link to the source code on http://core.trac.wordpress.org/browser/.

Parameters

  1. filename
  2. (option) path to codetag/code (version) or codetrunk/code. This option is only used for a new function.br /Default: codetrunk/code -- trunk is the latest bleeding edge development version of WordPress.

Usage

Link to the stable version: pre检查到模板循环:模板:Trac/pre

Link to trunk: pre检查到模板循环:模板:Trac/pre

/div

wordpress.org.cn./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude


Description

Displays links associated with the named link category. This tag uses the settings you specify in the 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=nameshow_description=0show_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 tt'lt;br /gt;'/tt.
between 
(string) Text to place between each link/image and its description. Defaults to tt' '/tt (space).
show_images 
(boolean) Should images for links be shown.
  • tt1/tt (True - default)
  • tt0/tt (False)
orderby 
(string) Value to sort links on. Valid options:
  • tt'id'/tt (default)
  • tt'url'/tt
  • tt'name'/tt
  • tt'target'/tt
  • tt'category'/tt
  • tt'description'/tt
  • tt'owner'/tt - User who added link through Links Manager.
  • tt'rating'/tt
  • tt'updated'/tt
  • tt'rel'/tt - Link relationship (XFN).
  • tt'notes'/tt
  • tt'rss'/tt
  • tt'length'/tt - The length of the link name, shortest to longest.
Prefixing any of the above options with an underscore (ex: tt'_id'/tt) sorts links in reverse order.
  • tt'rand'/tt - Display links in random order.
show_description 
(boolean) Display the description. Valid if show_images is ttFALSE/tt or an image is not defined.
  • tt1/tt (True - default)
  • tt0/tt (False)
show_rating 
(boolean) Should rating stars/characters be displayed.
  • tt1/tt (True)
  • tt0/tt (False - default)
limit 
(integer) Maximum number of links to display. Defaults to tt-1/tt (all links).
show_updated 
(boolean) Should the last updated timestamp be displayed.
  • tt1/tt (True)
  • tt0/tt (False - default)
echo 
(boolean) Display the Links list (1 - true) or return the list to be used in PHP (0 - false). Defaults to 1.
  • tt1/tt (True - default)
  • tt0/tt (False)

Related

get_bookmark, get_bookmark_field, get_bookmarks, wp_list_bookmarks

includeonlydiv style=clear:both; background-color:#F7F7F7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;See also index of Function Reference and index of Template Tags./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude