wp_list_bookmarks [ WordPress Function ]
| Parameters: |
|
| Uses: |
|
| Links: | |
| See: | |
| Returns: |
|
| Defined at: |
|
Retrieve or echo all of the bookmarks.
List of default arguments are as follows: 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme. 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order. 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display. 'category' - Default is empty string (string). Include the links in what category ID(s). 'category_name' - Default is empty string (string). Get links by category name. 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'. 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. 'echo' - Default is 1 (integer). Whether to echo (default) or return the formatted bookmarks. 'categorize' - Default is 1 (integer). Whether to show links listed by category (default) or show links in one column. 'show_description' - Default is 0 (integer). Whether to show the description of the bookmark.
These options define how the Category name will appear before the category links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will display for only the 'title_li' string and only if 'title_li' is not empty. 'title_li' - Default is 'Bookmarks' (translatable string). What to show before the links appear. 'title_before' - Default is '
' (string). The HTML or text to show before the 'title_li' string. 'title_after' - Default is '
' (string). The HTML or text to show after the 'title_li' string. 'class' - Default is 'linkcat' (string). The CSS class to use for the 'title_li'.
'category_before' - Default is '
These are only used if 'categorize' is set to 1 or true. 'category_orderby' - Default is 'name'. How to order the bookmark category based on term scheme. 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) or DESC (descending).
Source
<?php
function wp_list_bookmarks($args = '') {
$defaults = array(
'orderby' => 'name', 'order' => 'ASC',
'limit' => -1, 'category' => '', 'exclude_category' => '',
'category_name' => '', 'hide_invisible' => 1,
'show_updated' => 0, 'echo' => 1,
'categorize' => 1, '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>'
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
$output = '';
if ( $categorize ) {
//Split the bookmarks into ul's for each category
$cats = get_terms('link_category', array('name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0));
foreach ( (array) $cats as $cat ) {
$params = array_merge($r, array('category'=>$cat->term_id));
$bookmarks = get_bookmarks($params);
if ( empty($bookmarks) )
continue;
$output .= str_replace(array('%id', '%class'), array("linkcat-$cat->term_id", $class), $category_before);
$catname = apply_filters( "link_category", $cat->name );
$output .= "$title_before$catname$title_after\n\t<ul class='xoxo blogroll'>\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n$category_after\n";
}
} else {
//output one single list using title_li for the title
$bookmarks = get_bookmarks($r);
if ( !empty($bookmarks) ) {
if ( !empty( $title_li ) ){
$output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);
$output .= "$title_before$title_li$title_after\n\t<ul class='xoxo blogroll'>\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n$category_after\n";
} else {
$output .= _walk_bookmarks($bookmarks, $r);
}
}
}
$output = apply_filters( 'wp_list_bookmarks', $output );
if ( !$echo )
return $output;
echo $output;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- wp_list_bookmarks() - WordPress Codex
NOTE: wp_list_bookmarks() intended to replace the deprecated ...
codex.wordpress.org - WP 3.2, wp_list_bookmarks, orderby=id: not working - WordPress
Hi,. I recently updated to WordPress 3.2. When I did, my list of bookmarks stopped working correctly. They always displayed ordered by id, as I had specified in ...
wordpress.org - Wp_list_bookmarks | Lanexa.net
May 31, 2011 ... The WordPress platform comes with an intriguing – yet often neglected – link managing feature in the Dashboard menu called Links. What's ...
www.lanexa.net - Wordpress: How to use filter to restructure wp_list_bookmarks ...
Apr 6, 2012 ... I'm using the wp_list_bookmarks() function to create a supplier resource page on a site I'm working on. Some of the links will have logos, some ...
stackoverflow.com
Gebruikersdiscussies [ wordpress.org ]
- Marventus on "Bookmarks Template Issue. Space between image and name."
- lachie_h on "Bookmarks Template Issue. Space between image and name."
- Nicusor Dumbrava on "Integrate BM Shots plugin with WP Bookmarks/Links"
- jorhett on "wp_list_bookmarks provides no way to retrieve category id"
- brasofilo on "Bookmarks?"
- NateJacobs on "Bookmark category name without link (plain text)"
- millbank on "Bookmark category name without link (plain text)"
- deko-lt on "Filter class into wp_list_bookmarks?"
- RichardWPG on "Advice for listing links categories"
- Nicusor Dumbrava on "Advice for listing links categories"