Friday, December 12, 2014
Styling WordPress 2.7 Comments
A few weeks ago I wrote about the WordPress 2.7 theme enhancementsand specifically how the comments were now output using the tag wp_list_comments(). However, this controls all output of your markup and for a lot of people, this is different to how their existing theme is.
[sourcecode language=”html”]
November 30th, 2008 at 10:00 am
Comment content goes here.
[/sourcecode]
This is fine, but for my own site this wasn’t what I wanted. I’m sure I could have used this and moved things around with CSS but luckily the WordPress developers have realised that not everyone would want the same comment output and they allow you to create your own markup and then use a callback function.
How Does This Work?
A callback parameter is added to the wp_list_comments() function. The value of this parameter is the name of the function with the code you would like to use. This function is then stored in a functions.php file within your theme directory (you may already have this file, so just add the function to it).
So first off we need to decide on the output. You’ve probably already got this in your existing theme so you can most likely copy this out. To know where to start you need to be starting with an opening list item (li tag) and then close with a closing list item tag. Of course every theme is different so if you’re not sure then post up a comment with a link to a text version of your file and I’ll happily help you out
For my own theme this was
[sourcecode language=”html”] By on
By on

No comments: