Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save BronsonQuick/2692275 to your computer and use it in GitHub Desktop.
Save BronsonQuick/2692275 to your computer and use it in GitHub Desktop.
Move the posts count inside the link of the Archive and Category widgets of WordPress
@Dilden
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