sidebar count with style revisited  [ 793 views ]

Goal: fix all the sidebar list (archives by …, categories)

I did this correction earlier on categories list ( see also: category count with style ).
I will do this on archives list as well based on the previous solution and overriding that one.
1. get the archives list with count:

wp_get_archives('type=monthly&show_post_count=1');

2. counter changes:
We have numbers between parentheses but this is not good I need to wrap the numbers into a span.
Add this to the end of the functions.php file. This change is for all sidebar lists!

...
/* added functions */
add_filter('get_archives_link', 'wrap_counter_to_span' );
function wrap_counter_to_span($links) {
  $links = str_replace('(', '<span class="cnt">(', $links);
  $links = str_replace(')', ')</span>', $links);
  return $links;
}

This change affects the category list creation as well!
Now we need a simple style definition in our style.css file.

#sidebar span.cnt{
  font: 10px Verdana, 'Lucida Grande', Arial, Sans-Serif;
}

see also: category count with style

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }