Function Reference/get links
(Add your language)
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
Use any of these functions
Like wp_get_links(), this tag displays links from the 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.
<?php get_links(category, 'before', 'after',
'between', show_images, 'order',
show_updated, echo); ?>
By default, the usage shows:
- All links
- Line breaks after each link 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(); ?>
Specific Category Sorted by URL
Displays links for link category ID 2 in span tags, uses images for links, does not show descriptions, sorts by link URL.
<?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.
<?php get_links('-1', '<li>', '</li>', '<br />', FALSE, 'id', TRUE,
TRUE, -1, TRUE, TRUE); ?>
- (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).
- (string) Text to place before each link. There is no default.
- (string) Text to place after each link. Defaults to '<br />'.
- (string) Text to place between each link/image and its description. Defaults to ' ' (space).
- (boolean) Should images for links be shown (TRUE) or not (FALSE). Defaults to TRUE.
- (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:
- 'owner' - User who added link through Links Manager.
- 'rel' - Link relationship (XFN).
- '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.
- (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.
- (boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE.
- (integer) Maximum number of links to display. Defaults to -1 (all links).
- (boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE.
- (boolean) Display links (TRUE) or return them for use PHP (FALSE). Defaults to TRUE.