Instantly share code, notes, and snippets.

Embed
What would you like to do?
Move the posts count inside the link of the Archive and Category widgets of WordPress
@Dilden

This comment has been minimized.

Copy link

Dilden commented Sep 12, 2014

Whoa... That's pretty nice. Thanks for this! I did have to do some tweaking though.

add_filter('wp_list_categories', 'cat_count_span');
function cat_count_span($links) {
    $links = str_replace('</a>', '', $links);
    $links = str_replace('</li>', '</a></li>', $links);
    return $links;
}

I actually had some categories that had the "(" category string and this fixed that.

BTW, I was linked here from http://snipplr.com/view/71843/move-the-posts-count-inside-the-link-of-the-archive-and-category-widgets-of-wordpress/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment