Ticket #2587: 2587.wp_list_bookmarks.diff
| File 2587.wp_list_bookmarks.diff, 2.7 KB (added by westi, 6 years ago) |
|---|
-
wp-includes/bookmark-template.php
316 316 else 317 317 parse_str($args, $r); 318 318 319 $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => 0,319 $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 320 320 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 321 321 'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>', 322 322 'category_orderby' => 'name', 'category_order' => 'ASC'); 323 323 $r = array_merge($defaults, $r); 324 324 extract($r); 325 325 326 // TODO: The rest of it.327 // If $categorize, group links by category with the category name being the328 // title of each li, otherwise just list them with title_li as the li title.329 // If $categorize and $category or $category_name, list links for the given category330 // with the category name as the title li. If not $categorize, use title_li.331 // When using each category's name as a title li, use before and after args for specifying332 // any markup. We don't want to hardcode h2.333 334 326 $output = ''; 335 327 336 328 if ( $categorize ) { 337 $cats = get_categories("type=link&orderby=$category_orderby&order=$category_order&hierarchical=0"); 329 //Split the bookmarks into ul's for each category 330 $cats = get_categories("type=link&category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0"); 331 338 332 foreach ( (array) $cats as $cat ) { 339 $r['category'] = $cat->cat_ID; 340 $bookmarks = get_bookmarks($r); 333 $bookmarks = get_bookmarks("limit=$limit&category={$cat->cat_ID}&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_inivisible&show_updated=$show_updated"); 341 334 if ( empty($bookmarks) ) 342 335 continue; 343 336 $output .= "<li id='linkcat-$cat->cat_ID' class='linkcat'>$title_before$cat->cat_name$title_after\n\t<ul>\n"; 344 337 $output .= _walk_bookmarks($bookmarks, $r); 345 338 $output .= "\n\t</ul>\n</li>\n"; 346 339 } 340 } else { 341 //output one single list using title_li for the title 342 $bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_inivisible&show_updated=$show_updated"); 343 344 if ( !empty($bookmarks) ) { 345 $output .= "<li id='linkuncat' class='linkcat'>$title_before$title_li$title_after\n\t<ul>\n"; 346 $output .= _walk_bookmarks($bookmarks, $r); 347 $output .= "\n\t</ul>\n</li>\n"; 348 } 347 349 } 348 350 349 351 if ( !$echo ) … … 351 353 echo $output; 352 354 } 353 355 354 ?> 355 No newline at end of file 356 ?>
