Forked from BronsonQuick/link_inside_archive_and_category_widget.php
Last active
December 26, 2015 17:59
-
-
Save kosinix/7191571 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This code filters the Categories archive widget to include the post count inside the link */ | |
add_filter('wp_list_categories', 'cat_count_span'); | |
function cat_count_span($links) { | |
$links = str_replace('</a> (', ' <span class="count">(', $links); | |
$links = str_replace(')', ')</span></a>', $links); | |
return $links; | |
} | |
/* This code filters the Archive widget to include the post count inside the link */ | |
add_filter('get_archives_link', 'archive_count_span'); | |
function archive_count_span($links) { | |
$links = str_replace('</a> (', ' <span class="count">(', $links); | |
$links = str_replace(')', ')</span></a>', $links); | |
return $links; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment