sidebar count with style revisited [ 1187 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


