WordPress.org

Make WordPress Core

Changeset 4263


Ignore:
Timestamp:
10/02/06 18:01:07 (8 years ago)
Author:
ryan
Message:

wp_list_bookmarks() enhanccements from westi. #2587

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/bookmark-template.php

    r4256 r4263  
    317317        parse_str($args, $r); 
    318318 
    319     $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => 0, 
     319    $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 
    320320        'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 
    321321        'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>', 
     
    324324    extract($r); 
    325325 
    326     // TODO: The rest of it. 
    327     // If $categorize, group links by category with the category name being the 
    328     // 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 category 
    330     // 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 specifying 
    332     // any markup.  We don't want to hardcode h2. 
    333  
    334326    $output = ''; 
    335327 
    336328    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 
    338332        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"); 
    341334            if ( empty($bookmarks) ) 
    342335                continue; 
     
    345338            $output .= "\n\t</ul>\n</li>\n"; 
    346339        } 
     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        } 
    347349    } 
    348350 
Note: See TracChangeset for help on using the changeset viewer.