I have the following code to display posts in WordPress
<?php wp_get_archives('type=monthly&show_post_count=1'); ?>
How can I add a span class around the count so I can style it?
The above code produces this:
October (9)
November (22)
December (3)
I need to assign a span class to the count, and not entire output.
Easiest option is with a little bit of CCS magic. At the moment, I am assuming your template code (for the archive block) is along the lines of:
Firstly, add a class to your list:
Secondly, add some lines to your CSS to style the relevant bits
The Hard option is to set the “echo” parameter on wp_get_achives to 0/false.
That way the method will return an array of data and leave it up to your to loop over it and print it out.Edit My mistake, it returns it just as a string, which means this is going to be quite tricky. Depends on how much styling you need to apply.