Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wp_list_bookmarks_jr($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 );
- $catdescr = apply_filters("link_category", $cat->description);// getting category description
- $output .= "$title_before$catname$title_after\n<p>$catdescr</p>\t<ul class='xoxo nostyle'>\n";//added my own 'nostyle' class to the ul
- $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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement