WordPress V4.0+Template Tag Reference Guide as of Version 4.2
Presented by DBS > Interactive Development :
Links Manager Tags
Get Bookmarkget_bookmark();
Retrieve Bookmark data based on bookmark link ID.
<?php get_bookmark($bookmark, $output, $filter); ?>
$bookmark
Integer • Default: none
The bookmark link ID.
$output
String • Default: 'OBJECT'
(Optional) Either 'OBJECT', 'ARRAY_N', or 'ARRAY_A constant.
$filter
String • Default: 'raw'
(Optional)
Get Bookmark Fieldget_bookmark_field();
Retrieve Bookmark data based on bookmark link ID.
<?php get_bookmark_field($field, $bookmark, $context); ?>
$field
String • Default: none
The name of the data field to return.
$bookmark
Integer • Default: none
The bookmark ID to get field.
$context
String • Default: 'display'
(Optional) The context of how the field will be used.
Get Bookmarksget_bookmarks();
This function returns an array of bookmarks found in the Administration > Links > Edit panel. This Template Tag allows the user to retrieve the bookmark information directly.
$args = array( | ||||
'orderby' | => | 'name', | ||
'order' | => | 'ASC', | ||
'number' | => | null, | ||
'limit' | => | -1, | ||
'category' | => | , | ||
'category_name' | => | , | ||
'hide_invisible' | => | true, | ||
'show_updated' | => | false, | ||
'include' | => | , | ||
'exclude' | => | , | ||
'search' | => | |||
); |
<?php get_bookmarks($args); ?>
orderby
String • Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'
Value to sort bookmarks on.. Valid options:
- 'id'
- 'url'
- 'name' - Default
- 'target'
- 'description'
- 'owner' - User who added bookmark through bookmarks Manager.
- 'rating'
- 'updated'
- 'rel' - bookmark relationship (XFN).
- 'notes'
- 'rss'
- 'length' - The length of the bookmark name, shortest to longest.
- 'rand' - Display bookmarks in random order.
order
String • Default: 'ASC'
Sort order, ascending or descending for the orderby parameter. Valid values:
- ASC
- DESC
limit
Integer • Default: -1 (all bookmarks)
Maximum number of bookmarks to display.
category
String • Default: ''
Comma separated list of bookmark category ID's.
category_name
String • Default: ''
Category name of a catgeory of bookmarks to retrieve. Overrides category parameter.
hide_invisible
Boolean • Default: true
True causes only bookmarks with link_visible set to 'Y' to be retrieved.
show_updated
Boolean • Default: false
True causes an extra column called "link_category_f" to be inserted into the results, which contains the same value as "link_updated", but in a unix timestamp format. Handy for using PHP date functions on this data.
include
String • Default: (all Bookmarks)
Comma separated list of numeric bookmark IDs to include in the output. For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6. If the include string is used, the category, category_name, and exclude parameters are ignored.
exclude
String • Defaults to (exclude nothing)
Comma separated list of numeric bookmark IDs to exclude. For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed.
search
String • Default: ''
Searches link_url, link_name or link_description like the search string.
WP List Bookmarkswp_list_bookmarks();
Displays bookmarks found in the Administration > Links panel. This Template Tag allows the user to control how the bookmarks are sorted and displayed. NOTE: wp_list_bookmarks() intended to replace the deprecated Template tags get_links_list() and get_links().
$args = array( | ||||
'orderby' | => | 'name', | ||
'order' | => | 'ASC', | ||
'limit' | => | -1, | ||
'category' | => | , | ||
'exclude_category' | => | , | ||
'category_name' | => | , | ||
'hide_invisible' | => | true, | ||
'show_updated' | => | false, | ||
'echo' | => | true, | ||
'categorize' | => | false, | ||
'title_li' | => | __('Bookmarks'), | ||
'title_before' | => | '<h2>', | ||
'title_after' | => | '</h2>', | ||
'category_orderby' | => | 'name', | ||
'category_order' | => | 'ASC', | ||
'class' | => | 'linkcat', | ||
'category_before' | => | '<li id=%id class=%class>', | ||
'category_after' | => | '</li>' | ||
); |
<?php wp_list_bookmarks($args); ?>
orderby
String • Default: 'name'
Value to sort bookmarks on. This can be a COMMA separated list of values. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'. Valid options:
- 'id'
- 'url'
- 'name' - Default
- 'target'
- 'description'
- 'owner' - User who added bookmark through bookmarks Manager.
- 'rating'
- 'updated' Note: the link_updated field does not track local modifications. It tracks when whatever the link points to is updated via remote requests to pingomatic.
- 'rel' - bookmark relationship (XFN).
- 'notes'
- 'rss'
- 'length' - The length of the bookmark name, shortest to longest.
- 'rand' - Display bookmarks in random order.
order
String • Default: 'ASC'
Bookmarks display sorting order, ascending or descending as defined in the 'orderby' parameter. Valid values: 'ASC' or 'DESC'.
limit
Integer • Default: -1
Maximum number of bookmarks to display. Default is -1 (all bookmarks).
category
String • Default: (all Categories)
Comma separated list of numeric Category IDs to be displayed. If none is specified, all Categories with bookmarks are shown.
exclude_category
String • Default: (no categories excluded)
Comma separated list of numeric Category IDs to be excluded from display.
category_name
String • Default: (all Categories)
The name of a Category whose bookmarks will be displayed. If none is specified, all Categories with bookmarks are shown.
hide_invisible
Boolean • Default: true
Should bookmark be displayed even if its Visible setting is No. Abides by admin setting (true) or does not abide by admin setting (false).
show_updated
Boolean • Default: false
Should the last updated timestamp be displayed (true) or not (false). Note that link_updated does not track local modifications. It tracks when whatever the link points to is updated via remote requests to pingomatic.
echo
Boolean • Default: true
Display bookmarks (true) or return them for use by PHP (false).
categorize
Boolean • Default: true
Bookmarks should be shown within their assigned Categories or not.
title_li
String • Default: '__('Bookmarks')', which displays "Bookmarks" (the __('') is used for localization purposes)
Text for the heading of the links list. Only used when categorize it set to 0 [false] (else the category names will be used instead). If 'title_li' is set to null (0) value, no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags (be sure to pass the categorize option to 0 [false] to make this option take effect).
title_before
String • Default: '<h2>'
Text to place before each Category description if 'categorize' is true, or text defined in "title_li" if 'categorize' is false.
title_after
String • Default: '</h2>'
Text to place after each Category description if 'categorize' is true, or text defined in "title_li" if 'categorize' is false.
category_orderby
String • Default: 'name'
Value to sort Categories on. Valid options:
- 'name' - Default
- 'id'
- 'slug'
- 'count'
- 'term_group' (not used yet)
category_order
String • Default: 'ASC'
Sort order, ascending or descending for the category_orderby parameter. Valid values: ASC or DESC
class
String • Default: 'linkcat'
The class each category li will have assigned to it.
category_before
String • Default: '<li id="[category id]" class="linkcat">'
Text to place before each category.
category_after
String • Default: '</li>'
Text to place after each category.
show_private
Boolean • Default: false
Should a Category be displayed even if the Category is considered private. Ignore the admin setting and show private Categories (true) or do NOT show private Categories (false).
include
String • Default: (all Bookmarks)
Comma separated list of numeric bookmark IDs to include in the output. For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6. If the include string is used, the category, category_name, and exclude parameters are ignored.
exclude
String • Default: (exclude nothing)
Comma separated list of numeric bookmark IDs to exclude. For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed.
before
String • Default: '<li>'
Text to place before each bookmark.
after
String • Default: '<li>'
Text to place after each bookmark.
link_before
String • Default: none
Text to place before the text of each bookmark, inside the hyperlink code.
link_after
String • Default: none
Text to place after the text of each bookmark.
between
String • Default: '\n' (newline)
Text to place between each bookmark/image and its description.
show_images
Boolean • Default: true
Whether images for bookmarks should be shown (true) or not (talse).
show_description
Boolean • Default: false
Should the description be displayed (true) or not (false). Valid when show_images is false, or an image is not defined.
show_name
Boolean • Default: false
Displays the text of a link when true. Works when show_images is true.
show_rating
Boolean • Default: false
Whether rating stars/characters should be displayed (true) or not (false).
Add a Trailing Slashuser_trailingslashit();
Retrieve trailing slash string, if blog set for adding trailing slashes. Conditionally adds a trailing slash if the permalink structure has a trailing slash, strips the trailing slash if not. The string is passed through the ‘user_trailingslashit’ filter. Will remove trailing slash from string, if blog is not set to have them.
<?php user_trailingslashit($string, $type_of_string); ?>
$string
String • Default: None
URL with or without a trailing slash.
$type_of_string
String • Default: None
The type of URL being considered (e.g. single, category, etc) for use in the filter.
Edit the Post Linkedit_post_link();
Displays a link to edit the current post, if a user is logged in and allowed to edit the post. Can be used within The Loop or outside of it. If outside the loop, you'll need to pass the post ID. Can be used with pages, posts, attachments, and revisions.
<?php edit_post_link($link, $before, $after, $id); ?>
$link
String • Default: __('Edit This')
The link text.
$before
String • Default: None
(Optional) Text to put before the link text.
$after
String • Default: None
(Optional) Text to put after the link text.
$id
Integer • Default: None
(Optional) Post ID
Edit the Tag Linkedit_tag_link();
Displays a link to edit the current tag, if the user is logged in and allowed to edit the tag. It must be within The Loop.
<?php edit_tag_link($link, $before, $after, $id); ?>
$link
String • Default: __('Edit This')
The link text.
$before
String • Default: None
(Optional) Text to put before the link text.
$after
String • Default: None
(Optional) Text to put after the link text.
$tag
Integer • Default: None
(Optional) Current tag ID