WordPress: Template Tags/get linksbyname:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: {{Deprecated}} == Description == Like wp_get_linksbyname(), this tag displays links from the WordPress:Links Manager, but allows the us...)
 
无编辑摘要
第1行: 第1行:
{{Deprecated}}
{{Deprecated}}
== Description ==
== Description ==
{{取消的}}
== 描述 ==


Like [[WordPress:Template Tags/wp_get_linksbyname|wp_get_linksbyname()]], this tag displays links from the [[WordPress:Links Manager]], but allows the user to control how they are displayed by tag parameters, rather than through the WordPress admin interface (useful when displaying links on more than one template).
Like [[WordPress:Template Tags/wp_get_linksbyname|wp_get_linksbyname()]], this tag displays links from the [[WordPress:Links Manager]], but allows the user to control how they are displayed by tag parameters, rather than through the WordPress admin interface (useful when displaying links on more than one template).


像[[WordPress:Template Tags/wp_get_linksbyname|wp_get_linksbyname()]]一样,这个标签显示来自[[WordPress:Links Manager|链接管理器]]中的链接,但是允许用户通过标签参数控制链接的显示方式,而不是通过WordPress管理界面(在几个模板上显示链接的时候,有用),控制链接的显示方式。
== Replace With ==
== Replace With ==
== 取代 ==
[[WordPress:Template_Tags/wp_list_bookmarks|wp_list_bookmarks()]].


[[WordPress:Template_Tags/wp_list_bookmarks|wp_list_bookmarks()]].
[[WordPress:Template_Tags/wp_list_bookmarks|wp_list_bookmarks()]].


== Usage ==
== Usage ==
== 用法 ==
%%% <?php get_linksbyname('cat_name', 'before',
'after', 'between', show_images, 'orderby',
show_description, show_rating, limit,
show_updated); ?> %%%


%%% <?php get_linksbyname('cat_name', 'before',  
%%% <?php get_linksbyname('cat_name', 'before',  
第16行: 第31行:


== Examples ==
== Examples ==
==例子 ==


===Default Usage===
===Default Usage===
===默认用法===


By default, the tag shows:
By default, the tag shows:
默认情况下,标签显示:


* All categories if none are specified
* All categories if none are specified
*如果没有特别规定,将显示所有类别
* All category links are shown
* All category links are shown
*显示所有类别链接
* Puts a line break after the link item
* Puts a line break after the link item
*在链接item后面放置一个行分隔符
* Puts a space between the image and link (if one is included)
* Puts a space between the image and link (if one is included)
*在图像和链接之间放置一个空格(如果包含了图像的话)
* Shows link images if available
* Shows link images if available
*如果有链接图像的话,显示链接图像
* List sorted by ID
* List sorted by ID
*根据ID分类的列表
* Shows the link description
* Shows the link description
*显示链接描述
* Does not show the rating
* Does not show the rating
*不显示等级级别
* With no limit listed, it shows all links
* With no limit listed, it shows all links
*不列出限制,显示所有链接
* Does not show the updated timestamp
* Does not show the updated timestamp
*不显示更新的时间


  <?php get_linksbyname(); ?>
  <?php get_linksbyname(); ?>
<?php get_linksbyname(); ?>


=== Specific Category Sorted by Name ===
=== Specific Category Sorted by Name ===
=== 根据名称分类的特别类别 ===


Displays links for link category "Friends" in an unordered list with descriptions on the next line, sorts by link name.  
Displays links for link category "Friends" in an unordered list with descriptions on the next line, sorts by link name.  
在一个无序的列表上显示链接类别为"朋友"的链接,并且在下一行中显示描述,根据链接名称分类。


  &lt;ul&gt;
  &lt;ul&gt;
<?php get_linksbyname('Friends', '&lt;li&gt;', '&lt;/li&gt;', '&lt;br /&gt;', FALSE,
'name', TRUE); ?>
&lt;/ul&gt;
&lt;ul&gt;
  <?php get_linksbyname('Friends', '&lt;li&gt;', '&lt;/li&gt;', '&lt;br /&gt;', FALSE,  
  <?php get_linksbyname('Friends', '&lt;li&gt;', '&lt;/li&gt;', '&lt;br /&gt;', FALSE,  
  'name', TRUE); ?>
  'name', TRUE); ?>
第44行: 第104行:


=== With Images and Ratings, No Descriptions===
=== With Images and Ratings, No Descriptions===
=== 拥有图像和等级级别,没有描述===


Displays all links one per line without descriptions, uses images for links, sorts by link name, and shows ratings.
Displays all links one per line without descriptions, uses images for links, sorts by link name, and shows ratings.
显示所有的链接,每行显示一个链接,为链接使用图像,根据链接名分类,显示链接级别。


  <?php get_linksbyname(&#39;&#39;, &#39;&#39;, '&lt;br /&gt;', &#39;&#39;, TRUE, 'name', FALSE, TRUE); ?>
  <?php get_linksbyname(&#39;&#39;, &#39;&#39;, '&lt;br /&gt;', &#39;&#39;, TRUE, 'name', FALSE, TRUE); ?>
<?php get_linksbyname(&#39;&#39;, &#39;&#39;, '&lt;br /&gt;', &#39;&#39;, TRUE, 'name', FALSE, TRUE); ?>




=== As a Definition List with Images and Descriptions in Separate Tags ===
=== As a Definition List with Images and Descriptions in Separate Tags ===
===作为一个定义列表,图像和描述分别在不同的标签中 ===


Displays all links in a Definition List, places linked images in the &lt;dt&gt;, descriptions in the &lt;dd&gt;, and sorts by rating but doesn't show it.
Displays all links in a Definition List, places linked images in the &lt;dt&gt;, descriptions in the &lt;dd&gt;, and sorts by rating but doesn't show it.
在一个定义列表中显示所有的链接,将链接进的图像放到&lt;dt&gt;描述放到&lt;dd&gt;,同时根据链接级别分类,但是不显示链接级别。


  &lt;dl&gt;
  &lt;dl&gt;
  &lt;?php get_linksbyname('Portfolio', '&lt;dt&gt;',
        '&lt;/dd&gt;','&lt;/dt&gt;&lt;dd&gt;', TRUE, 'rating',
        TRUE, FALSE, -1, FALSE); ?&gt;
&lt;/dl&gt;
&lt;dl&gt;
   &lt;?php get_linksbyname('Portfolio', '&lt;dt&gt;',
   &lt;?php get_linksbyname('Portfolio', '&lt;dt&gt;',
         '&lt;/dd&gt;','&lt;/dt&gt;&lt;dd&gt;', TRUE, 'rating',
         '&lt;/dd&gt;','&lt;/dt&gt;&lt;dd&gt;', TRUE, 'rating',
第61行: 第138行:


To see examples of styling this markup in a fluid/elastic, multi-column layout with backgrounds and hover effects, please see [http://www.scottmcdaniel.com/?p=33 Manipulating Definition Lists for Fun and Profit].
To see examples of styling this markup in a fluid/elastic, multi-column layout with backgrounds and hover effects, please see [http://www.scottmcdaniel.com/?p=33 Manipulating Definition Lists for Fun and Profit].
要看看在一个流畅的/易变的布局,拥有悬浮效果背景,设置这个markup的例子,请看看[http://www.scottmcdaniel.com/?p=33 有趣而实用地操作定义列表]。


== Parameters ==
== Parameters ==
== 参数 ==
; cat_name : (''string'') The name of the link category whose links will be displayed. If none is specified, all links are shown. Defaults to <tt>'noname'</tt> (all links).
; cat_name : (''string'') The name of the link category whose links will be displayed. If none is specified, all links are shown. Defaults to <tt>'noname'</tt> (all links).
; cat_name : (''string'')将要显示链接的链接类别名称。如果没有任何特别的规定,将会显示所有链接。默认为<tt>'没有名称'</tt> (所有链接)。
; before : (''string'') Text to place before each link. There is no default.
; before : (''string'') Text to place before each link. There is no default.
;之前:(''string'')每个链接之前放置的文本。没有默认设置。
; after : (''string'') Text to place after each link. Defaults to <tt>'&lt;br /&gt;'</tt>.
; after : (''string'') Text to place after each link. Defaults to <tt>'&lt;br /&gt;'</tt>.
;之后:(''string'')每个链接之后放置的文本。默认为<tt>'&lt;br /&gt;'</tt>。
; between : (''string'') Text to place between each link/image and its description. Defaults to <tt>' '</tt> (space).
; between : (''string'') Text to place between each link/image and its description. Defaults to <tt>' '</tt> (space).
; 之间: (''string'')每个链接/图像和各自的描述之间放置的文本。默认为<tt>' '</tt>(空格)。
; show_images : (''boolean'') Should images for links be shown (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; show_images : (''boolean'') Should images for links be shown (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
;显示_图像:(''boolean'')链接的图像应该显示(<tt>正确的</tt>)还是不应该显示(<tt>错误的</tt>)。默认为<tt>正确的</tt>。
; orderby : (''string'') Value to sort links on. Defaults to <tt>'id'</tt>. Valid options:
; orderby : (''string'') Value to sort links on. Defaults to <tt>'id'</tt>. Valid options:
; 顺序 : (''string'')给链接分类的参数。默认为<tt>'id'</tt>有效的选项:
:* <tt>'id'</tt>
:* <tt>'id'</tt>
:* <tt>'url'</tt>
:* <tt>'url'</tt>
第82行: 第183行:
:* <tt>'rss'</tt>
:* <tt>'rss'</tt>
:* <tt>'length'</tt> - The length of the link name, shortest to longest.
:* <tt>'length'</tt> - The length of the link name, shortest to longest.
:* <tt>'id'</tt>
:* <tt>'url'</tt>
:* <tt>'名称'</tt>
:* <tt>'目标'</tt>
:* <tt>'类别'</tt>
:* <tt>'描述'</tt>
:* <tt>'所有者'</tt> - 通过链接管理器添加链接的用户。
:* <tt>'等级级别'</tt>
:* <tt>'更新的'</tt>
:* <tt>'rel'</tt> - 链接关系 (XFN).
:* <tt>'注意'</tt>
:* <tt>'rss'</tt>
:* <tt>'长度'</tt> - 链接名的长度,从最短到最长不等。
: '''Prefixing any of the above options with an underscore (ex: '''<tt>'_id'</tt>''') sorts links in reverse order.'''
: '''Prefixing any of the above options with an underscore (ex: '''<tt>'_id'</tt>''') sorts links in reverse order.'''
: '''将以上的任何选项加上一个下滑线的前缀(例如: '''<tt>'_id'</tt>''')以相反的顺序给链接分类。'''
:* <tt>'rand'</tt> - Display links in random order.
:* <tt>'rand'</tt> - Display links in random order.
:* <tt>'rand'</tt> -以任意的顺序显示链接。
; show_description : (''boolean'') Display the description (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Valid if '''show_images''' is <tt>FALSE</tt> or an image is not defined. Defaults to <tt>TRUE</tt>.
; show_description : (''boolean'') Display the description (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Valid if '''show_images''' is <tt>FALSE</tt> or an image is not defined. Defaults to <tt>TRUE</tt>.
; show_description : (''boolean'')描述应该显示(<tt>正确的</tt>)还是不应该显示(<tt>错误的</tt>)。当'''show_images'''是<tt>错误的</tt>,或者没有定义一个图像的时候,是有效的。默认<tt>正确的</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>。
; limit : (''integer'') Maximum number of links to display. Defaults to <tt>-1</tt> (all links).
; limit : (''integer'') Maximum number of links to display. Defaults to <tt>-1</tt> (all links).
;限制:(''整数'')显示最多的链接的数目。默认为<tt>-1</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>。


== Related ==
== Related ==
第94行: 第233行:


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

2008年7月8日 (二) 14:23的版本

模板:Deprecated

Description


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.


描述

Like wp_get_linksbyname(), this tag displays links from the WordPress:Links Manager, but allows the user to control how they are displayed by tag parameters, rather than through the WordPress admin interface (useful when displaying links on more than one template).

wp_get_linksbyname()一样,这个标签显示来自链接管理器中的链接,但是允许用户通过标签参数控制链接的显示方式,而不是通过WordPress管理界面(在几个模板上显示链接的时候,有用),控制链接的显示方式。

Replace With

取代

wp_list_bookmarks().

wp_list_bookmarks().

Usage

用法

%%% <?php get_linksbyname('cat_name', 'before', 'after', 'between', show_images, 'orderby', show_description, show_rating, limit, show_updated); ?> %%%

%%% <?php get_linksbyname('cat_name', 'before', 'after', 'between', show_images, 'orderby', show_description, show_rating, limit, show_updated); ?> %%%

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
  • 在链接item后面放置一个行分隔符
  • Puts a space between the image and link (if one is included)
  • 在图像和链接之间放置一个空格(如果包含了图像的话)
  • Shows link images if available
  • 如果有链接图像的话,显示链接图像
  • List sorted by ID
  • 根据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 get_linksbyname(); ?>

<?php get_linksbyname(); ?>

Specific Category Sorted by Name

根据名称分类的特别类别

Displays links for link category "Friends" in an unordered list with descriptions on the next line, sorts by link name.

在一个无序的列表上显示链接类别为"朋友"的链接,并且在下一行中显示描述,根据链接名称分类。

<ul>
<?php get_linksbyname('Friends', '<li>', '</li>', '<br />', FALSE, 
'name', TRUE); ?>
</ul>


<ul>

<?php get_linksbyname('Friends', '<li>', '</li>', '<br />', FALSE, 
'name', TRUE); ?>
</ul>

With Images and Ratings, No Descriptions

拥有图像和等级级别,没有描述

Displays all links one per line without descriptions, uses images for links, sorts by link name, and shows ratings.

显示所有的链接,每行显示一个链接,为链接使用图像,根据链接名分类,显示链接级别。

<?php get_linksbyname('', '', '<br />', '', TRUE, 'name', FALSE, TRUE); ?>


<?php get_linksbyname('', '', '<br />', '', TRUE, 'name', FALSE, TRUE); ?>


As a Definition List with Images and Descriptions in Separate Tags

作为一个定义列表,图像和描述分别在不同的标签中

Displays all links in a Definition List, places linked images in the <dt>, descriptions in the <dd>, and sorts by rating but doesn't show it.

在一个定义列表中显示所有的链接,将链接进的图像放到<dt&gt;描述放到<dd&gt;,同时根据链接级别分类,但是不显示链接级别。

<dl>
  <?php get_linksbyname('Portfolio', '<dt>',
       '</dd>','</dt><dd>', TRUE, 'rating',
       TRUE, FALSE, -1, FALSE); ?> 
</dl>


<dl>

  <?php get_linksbyname('Portfolio', '<dt>',
       '</dd>','</dt><dd>', TRUE, 'rating',
       TRUE, FALSE, -1, FALSE); ?> 
</dl>

To see examples of styling this markup in a fluid/elastic, multi-column layout with backgrounds and hover effects, please see Manipulating Definition Lists for Fun and Profit.

要看看在一个流畅的/易变的布局,拥有悬浮效果背景,设置这个markup的例子,请看看有趣而实用地操作定义列表

Parameters

参数

cat_name
(string) The name of the link category whose links will be displayed. If none is specified, all links are shown. Defaults to 'noname' (all links).
cat_name
(string)将要显示链接的链接类别名称。如果没有任何特别的规定,将会显示所有链接。默认为'没有名称' (所有链接)。
before
(string) Text to place before each link. There is no default.

;之前:(string)每个链接之前放置的文本。没有默认设置。

after
(string) Text to place after each link. Defaults to '<br />'.

;之后:(string)每个链接之后放置的文本。默认为'<br />'

between
(string) Text to place between each link/image and its description. Defaults to ' ' (space).
之间
(string)每个链接/图像和各自的描述之间放置的文本。默认为' '(空格)。
show_images
(boolean) Should images for links be shown (TRUE) or not (FALSE). Defaults to TRUE.

;显示_图像:(boolean)链接的图像应该显示(正确的)还是不应该显示(错误的)。默认为正确的


orderby
(string) Value to sort links on. Defaults to 'id'. Valid options:
顺序
(string)给链接分类的参数。默认为'id'有效的选项:
  • 'id'
  • '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.
  • 'id'
  • 'url'
  • '名称'
  • '目标'
  • '类别'
  • '描述'
  • '所有者' - 通过链接管理器添加链接的用户。
  • '等级级别'
  • '更新的'
  • 'rel' - 链接关系 (XFN).
  • '注意'
  • 'rss'
  • '长度' - 链接名的长度,从最短到最长不等。


Prefixing any of the above options with an underscore (ex: '_id') sorts links in reverse order.
将以上的任何选项加上一个下滑线的前缀(例如: '_id')以相反的顺序给链接分类。
  • 'rand' - Display links in random order.
  • 'rand' -以任意的顺序显示链接。
show_description
(boolean) Display the description (TRUE) or not (FALSE). Valid if show_images is FALSE or an image is not defined. Defaults to TRUE.
show_description
(boolean)描述应该显示(正确的)还是不应该显示(错误的)。当show_images错误的,或者没有定义一个图像的时候,是有效的。默认正确的


show_rating
(boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE.
show_rating
(boolean)等级级别stars/字符是否应该显示(正确的) 或者不应该显示(错误的)。默认为错误的


limit
(integer) Maximum number of links to display. Defaults to -1 (all links).

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

show_updated
(boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE.
show_updated
(boolean)是否应该显示最后一次更新的时间(正确的)或者不应该显示 (错误的)。默认为错误的


Related

模板:Tag Link Manager Tags

模板:PHP Function Tag Footer


相关的

模板:标签链接管理器标签