Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Update for wordpress 2.8.
    Categories (mainly line offset):

    --- wp-includes/classes.php     2009-05-20 09:05:23.000000000 -0700
    +++ wp-includes/classes.php     2009-06-27 16:13:48.000000000 -0700
    @@ -1333,7 +1333,12 @@
                    else
                            $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
                    $link .= '>';
    -               $link .= $cat_name . '</a>';
    +               $link .= $cat_name;
    +
    +               if ( isset($show_count) && $show_count )
    +                       $link .= ' (' . intval($category->count) . ')';
    +
    +               $link .=  '</a>';
    
                    if ( (! empty($feed_image)) || (! empty($feed)) ) {
                            $link .= ' ';
    @@ -1363,8 +1368,8 @@
                                    $link .= ')';
                    }
    
    -               if ( isset($show_count) && $show_count )
    -                       $link .= ' (' . intval($category->count) . ')';
    +               /*if ( isset($show_count) && $show_count )
    +                       $link .= ' (' . intval($category->count) . ')'; */
    
                    if ( isset($show_date) && $show_date ) {
                            $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);

    Archives (more complete):

    --- wp-includes/general-template.php    2009-06-10 17:04:20.000000000 -0700
    +++ wp-includes/general-template.php    2009-06-27 16:10:28.000000000 -0700
    @@ -819,7 +819,8 @@
                                    $url = get_month_link( $arcresult->year, $arcresult->month );
                                    $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
                                    if ( $show_post_count )
    -                                       $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
    +                                       /*$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;*/
    +                                       $text .= '&nbsp;('.$arcresult->posts.')';
                                    $output .= get_archives_link($url, $text, $format, $before, $after);
                            }
                    }
    @@ -840,7 +841,8 @@
                                    $url = get_year_link($arcresult->year);
                                    $text = sprintf('%d', $arcresult->year);
                                    if ($show_post_count)
    -                                       $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
    +                                       /*$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;*/
    +                                       $text .= '&nbsp;('.$arcresult->posts.')';
                                    $output .= get_archives_link($url, $text, $format, $before, $after);
                            }
                    }
    @@ -862,7 +864,8 @@
                                    $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
                                    $text = mysql2date($archive_day_date_format, $date);
                                    if ($show_post_count)
    -                                       $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
    +                                       /*$after = '&nbsp;('.$arcresult->posts.')'.$afterafter;*/
    +                                       $text .= '&nbsp;('.$arcresult->posts.')';
                                    $output .= get_archives_link($url, $text, $format, $before, $after);
                            }
                    }
    @@ -891,7 +894,8 @@
                                                    $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week);
                                                    $text = $arc_week_start . $archive_week_separator . $arc_week_end;
                                                    if ($show_post_count)
    -                                                       $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
    +                                                       /*$after = '&nbsp;('.$arcresult->posts.')'.$afterafter;*/
    +                                                       $text .= '&nbsp;('.$arcresult->posts.')';
                                                    $output .= get_archives_link($url, $text, $format, $before, $after);
                                            }
                                    }

    To do the same with the Archives, I modified wp-includes/general-template.php:

    --- wp-includes/general-template.php    2008-12-30 10:35:45.000000000 -0800
    +++ wp-includes/general-template.php    2009-06-27 15:45:52.000000000 -0700
    @@ -766,7 +766,8 @@
                                    $url = get_month_link( $arcresult->year, $arcresult->month );
                                    $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
                                    if ( $show_post_count )
    -                                       $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
    +                                       /*$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;*/
    +                                       $text .= '&nbsp;('.$arcresult->posts.')';
                                    $output .= get_archives_link($url, $text, $format, $before, $after);
                            }
                    }

    IMHO it would be nice to have the choice to select where the options have to be added (part of the link or outside…).

    I’m not sure where is the best place to ask though.

    The only way I could make it work with the categories’ widget is to modify wp-includes/classes.php as following:

    --- wp-includes/classes.php     2008-12-09 10:03:31.000000000 -0800
    +++ wp-includes/classes.php     2009-06-27 15:13:25.000000000 -0700
    @@ -1318,7 +1318,12 @@
                    else
                            $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"';
                    $link .= '>';
    -               $link .= $cat_name . '</a>';
    +               $link .= $cat_name;
    +
    +               if ( isset($show_count) && $show_count )
    +                       $link .= ' (' . intval($category->count) . ')';
    +
    +               $link .=  '</a>';
    
                    if ( (! empty($feed_image)) || (! empty($feed)) ) {
                            $link .= ' ';
    @@ -1348,8 +1353,8 @@
                                    $link .= ')';
                    }
    
    -               if ( isset($show_count) && $show_count )
    -                       $link .= ' (' . intval($category->count) . ')';
    +               /*if ( isset($show_count) && $show_count )
    +                       $link .= ' (' . intval($category->count) . ')'; */
    
                    if ( isset($show_date) && $show_date ) {
                            $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);

    Even if I don’t really like to modify the core of wordpress, that’s the only way I found.

Viewing 3 replies - 1 through 3 (of 3 total)