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

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


Like [[WordPress:Template_Tags/wp_get_links|wp_get_links()]], 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).  This tag does ignore any link where the Visible property is set to No.
Like [[WordPress:Template_Tags/wp_get_links|wp_get_links()]], 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).  This tag does ignore any link where the Visible property is set to No.
像[[WordPress:Template_Tags/wp_get_links|wp_get_links()]]一样,这个标签显示来自[[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_links(category, 'before', 'after',
'between', show_images, 'order',
show_description,show_rating, limit,
show_updated, echo); ?> %%%


%%% <?php get_links(category, 'before', 'after',
%%% <?php get_links(category, 'before', 'after',
第16行: 第32行:


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


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


By default, the usage shows:
By default, the usage shows:
 
默认情况下,用法显示:
* All links
* All links
*所有链接
* Line breaks after each link item
* Line breaks after each link item
*每个链接item后面的行分隔符
* An image if one is included
* An image if one is included
*如果包含了一个链接,就会有一个图像
* A space between the image and the text
* A space between the image and the text
*图像和文本之间有一个空格
* Sorts the list by name
* Sorts the list by name
*根据名称给类别分类
* Shows the description of the link
* Shows the description of the link
*显示链接的描述
* Does not show the ratings
* Does not show the ratings
*不显示等级级别
* Unless limit is set, shows all links
* Unless limit is set, shows all links
*除非设置了限定,否则显示所有的链接
* Displays links as links not text
* Displays links as links not text
*将链接显示为链接而不是文本


  <?php get_links(); ?>
  <?php get_links(); ?>
<?php get_links(); ?>


=== Specific Category Sorted by URL ===
=== Specific Category Sorted by URL ===
===根据URL分类的特别的类别 ===


Displays links for link category ID 2 in span tags, uses images for links, does not show descriptions, sorts by link URL.  
Displays links for link category ID 2 in span tags, uses images for links, does not show descriptions, sorts by link URL.  
在span标签中为链接类别ID2显示链接,为链接使用图像,不显示描述,根据链接URL分类。


  <?php get_links(2, '&lt;span&gt;', '&lt;/span&gt;', &#39;&#39;, TRUE, 'url', FALSE); ?>
  <?php get_links(2, '&lt;span&gt;', '&lt;/span&gt;', &#39;&#39;, TRUE, 'url', FALSE); ?>
<?php get_links(2, '&lt;span&gt;', '&lt;/span&gt;', &#39;&#39;, TRUE, 'url', FALSE); ?>


=== Shows Ratings and Timestamp ===
=== Shows Ratings and Timestamp ===
=== 显示等级级别和时间标记 ===


Displays all links in an ordered list with descriptions on a new line, does not use images for links, sorts by link id, shows description, show rating, no limit to the number of links, shows last-updated timestamp, and echoes the results.
Displays all links in an ordered list with descriptions on a new line, does not use images for links, sorts by link id, shows description, show rating, no limit to the number of links, shows last-updated timestamp, and echoes the results.
在一个无序列表上显示所有的链接,重起一行显示描述,不为链接显示图像,根据链接id分类,显示描述,显示等级级别,对于链接的数目没有限制,显示最后更新的时间,并且echo结果。


  &lt;ol&gt;
  &lt;ol&gt;
<?php get_links('-1', '&lt;li&gt;', '&lt;/li&gt;', '&lt;br /&gt;', FALSE, 'id', TRUE,
TRUE, -1, TRUE, TRUE); ?>
&lt;/ol&gt;
&lt;ol&gt;
  <?php get_links('-1', '&lt;li&gt;', '&lt;/li&gt;', '&lt;br /&gt;', FALSE, 'id', TRUE,  
  <?php get_links('-1', '&lt;li&gt;', '&lt;/li&gt;', '&lt;br /&gt;', FALSE, 'id', TRUE,  
  TRUE, -1, TRUE, TRUE); ?>
  TRUE, -1, TRUE, TRUE); ?>
第49行: 第99行:


== Parameters ==
== Parameters ==
== 参数 ==


; category : (''integer'') The numeric ID of the link category whose links will be displayed. Display links in multiple categories by passing a string containing comma-separated list of categories, e.g. "4,11,3". If none is specified, all links are shown. Defaults to <tt>-1</tt> (all links).
; category : (''integer'') The numeric ID of the link category whose links will be displayed. Display links in multiple categories by passing a string containing comma-separated list of categories, e.g. "4,11,3". If none is specified, all links are shown. Defaults to <tt>-1</tt> (all links).
; 类别 : (''整数'')将要显示的链接的链接类别的ID数。审查通过一个包含用逗号分开的类别的列表的字符串,如"4,11,3",以在多个类别中显示链接。如果没有规定任何内容,将会显示所有链接。默认为<tt>-1</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>。
; order : (''string'') Value to sort links on. Defaults to <tt>'name'</tt> unless you pass the value of <tt>&#39;&#39;</tt> (empty), in which case it sets to <tt>'id'</tt>. Valid options:
; order : (''string'') Value to sort links on. Defaults to <tt>'name'</tt> unless you pass the value of <tt>&#39;&#39;</tt> (empty), in which case it sets to <tt>'id'</tt>. Valid options:
; 顺序 : (''string'')给链接分类的参数值。默认为<tt>'名称'</tt>,除非你审查通过了参数值<tt>&#39;&#39;</tt> (空的),在这种情况下,参数设置为<tt>'id'</tt>。有效的选项:
:* <tt>'id'</tt>
:* <tt>'id'</tt>
:* <tt>'url'</tt>
:* <tt>'url'</tt>
第69行: 第138行:
:* <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'') Should the description be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Valid when '''show_images''' is <tt>FALSE</tt>, or an image is not defined. Defaults to <tt>TRUE</tt>.
; show_description : (''boolean'') Should the description be displayed (<tt>TRUE</tt>) or not (<tt>FALSE</tt>). Valid when '''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>。
; echo : (''boolean'') Display links (<tt>TRUE</tt>) or return them for use PHP (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; echo : (''boolean'') Display links (<tt>TRUE</tt>) or return them for use PHP (<tt>FALSE</tt>). Defaults to <tt>TRUE</tt>.
; echo : (''boolean'')显示链接(<tt>正确的</tt>)或者将链接返回用于使用PHP(<tt>错误的</tt>)。默认为<tt>正确的</tt>。


== Related ==
== Related ==
第83行: 第191行:


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

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

模板: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_links(), 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). This tag does ignore any link where the Visible property is set to No.

wp_get_links()一样,这个标签显示来自链接管理器中的链接,但是允许用户通过标签参数控制链接的显示方式,而不是通过WordPress管理界面(在几个模板上显示链接的时候,有用),控制链接的显示方式。这个标签不会忽视,可视属性设置为否定的任何链接。

Replace With

取代

wp_list_bookmarks().

wp_list_bookmarks().

Usage

用法

%%% <?php get_links(category, 'before', 'after', 'between', show_images, 'order', show_description,show_rating, limit, show_updated, echo); ?> %%%

%%% <?php get_links(category, 'before', 'after', 'between', show_images, 'order', show_description,show_rating, limit, show_updated, echo); ?> %%%

Examples

例子

Default Usage

默认用法

By default, the usage shows: 默认情况下,用法显示:

  • All links
  • 所有链接
  • Line breaks after each link item
  • 每个链接item后面的行分隔符
  • An image if one is included
  • 如果包含了一个链接,就会有一个图像
  • A space between the image and the text
  • 图像和文本之间有一个空格
  • Sorts the list by name
  • 根据名称给类别分类
  • Shows the description of the link
  • 显示链接的描述
  • Does not show the ratings
  • 不显示等级级别
  • Unless limit is set, shows all links
  • 除非设置了限定,否则显示所有的链接
  • Displays links as links not text
  • 将链接显示为链接而不是文本
<?php get_links(); ?>

<?php get_links(); ?>

Specific Category Sorted by URL

根据URL分类的特别的类别

Displays links for link category ID 2 in span tags, uses images for links, does not show descriptions, sorts by link URL.

在span标签中为链接类别ID2显示链接,为链接使用图像,不显示描述,根据链接URL分类。

<?php get_links(2, '<span>', '</span>', '', TRUE, 'url', FALSE); ?>

<?php get_links(2, '<span>', '</span>', '', TRUE, 'url', FALSE); ?>

Shows Ratings and Timestamp

显示等级级别和时间标记

Displays all links in an ordered list with descriptions on a new line, does not use images for links, sorts by link id, shows description, show rating, no limit to the number of links, shows last-updated timestamp, and echoes the results.

在一个无序列表上显示所有的链接,重起一行显示描述,不为链接显示图像,根据链接id分类,显示描述,显示等级级别,对于链接的数目没有限制,显示最后更新的时间,并且echo结果。

<ol>
<?php get_links('-1', '<li>', '</li>', '<br />', FALSE, 'id', TRUE, 
TRUE, -1, TRUE, TRUE); ?>
</ol>

<ol>

<?php get_links('-1', '<li>', '</li>', '<br />', FALSE, 'id', TRUE, 
TRUE, -1, TRUE, TRUE); ?>
</ol>

Parameters

参数

category
(integer) The numeric ID of the link category whose links will be displayed. Display links in multiple categories by passing a string containing comma-separated list of categories, e.g. "4,11,3". If none is specified, all links are shown. Defaults to -1 (all links).
类别
(整数)将要显示的链接的链接类别的ID数。审查通过一个包含用逗号分开的类别的列表的字符串,如"4,11,3",以在多个类别中显示链接。如果没有规定任何内容,将会显示所有链接。默认为-1(所有链接)。
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)链接的图像应该显示(正确的)还是不应该显示(错误的)。默认为正确的

order
(string) Value to sort links on. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets 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) Should the description be displayed (TRUE) or not (FALSE). Valid when 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)是否应该显示最后一次更新的时间(正确的)或者不应该显示 (错误的)。默认为错误的
echo
(boolean) Display links (TRUE) or return them for use PHP (FALSE). Defaults to TRUE.
echo
(boolean)显示链接(正确的)或者将链接返回用于使用PHP(错误的)。默认为正确的


Related

模板:Tag Link Manager Tags

模板:PHP Function Tag Footer


相关的

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