Make WordPress Core


Ignore:
Timestamp:
03/23/2004 04:45:27 AM (23 years ago)
Author:
rboren
Message:

Add feed and feed_image options to wp_list_cats() and wp_list_authors().

File:
1 edited

Legend:

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

    r979 r987  
    248248        if (!isset($r['categories'])) $r['categories'] = 0;
    249249        if (!isset($r['recurse'])) $r['recurse'] = 0;
    250         list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'],
    251         $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'],
    252         $r['children'], $r['child_of'], $r['categories'], $r['recurse']);
    253 }
    254 
    255 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0) {
     250        if (!isset($r['feed'])) $r['feed'] = '';
     251        if (!isset($r['feed_image'])) $r['feed_image'] = '';
     252
     253        list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'],  $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image']);
     254}
     255
     256function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '') {
    256257    global $tablecategories, $tableposts, $tablepost2cat, $wpdb;
    257258    global $pagenow;
    … …  
    319320            $link .= '>';
    320321            $link .= stripslashes($category->cat_name).'</a>';
     322
     323            if ( (! empty($feed_image)) || (! empty($feed)) ) {
     324               
     325                $link .= ' ';
     326
     327                if (empty($feed_image)) {
     328                    $link .= '(';
     329                }
     330
     331                $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename)  . '"';
     332
     333                if (! empty($feed)) {
     334                    $title =  ' title="' . stripslashes($feed) . '"';
     335                    $alt = ' alt="' . stripslashes($feed) . '"';
     336                    $name = stripslashes($feed);
     337                    $link .= $title;
     338                }
     339
     340                $link .= '>';
     341
     342                if (! empty($feed_image)) {
     343                    $link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
     344                } else {
     345                    $link .= $name;
     346                }
     347               
     348                $link .= '</a>';
     349
     350                if (empty($feed_image)) {
     351                    $link .= ')';
     352                }
     353            }
     354
    321355            if (intval($optioncount) == 1) {
    322356                $link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
Note: See TracChangeset for help on using the changeset viewer.