I’m still pinned against wordpress it seems. I added the widget ‘Archives’ to my sidebar and once more, the html output is crap, it basically has this structure:
<li><a href="somelink">text</a> - (# of posts)</li>
I want to transform it into:
<li><a href="somelink">text <small># of posts</small></a>
Unlike with plugins however, I wasn’t able to find the line that creates the html output in the php pages suggested/mentioned by the wordpress community, namely functions.php, widgets.php and default-widgets.php
I’ve googled every possible keyword combination on the matter and I was unable to find something relevant.
All help is appreciated
Regards
G.Campos
Check out general-template.php. Two functions wp_get_archives and get_archives_link. You’d have to hack wp_get_archives to change what gets loaded in $text. The post count gets loaded into the $after variable which placed outside the link in get_archives_link. Instead of this:
something like this:
That’s just for the Monthly archive. You’d have to make modifications on the Yearly, Weekly and Daily blocks.
Edit: Easiest way to exclude the
<small>
element from the link’s title is to load it up in a separate variable in each block and then pass it into a modified get_archives_link. In the example above, right after $text gets loaded up just load that value into $title:Then modify get_archives_link:
Add this code inside your theme functions.php file, It will wrap post archive counts inside span tag. In below code example I wrapped counts in span tag, you can add or modify it according to your requirement.