[wp-hackers] Uneasy over the Walkers

Joost de Valk joost at yoast.com
Thu Mar 26 15:25:54 GMT 2009

Hi Simon,

no need, you can simply do a callback:

<?php wp_list_comments('type=comment&callback=yoast_comment'); ?>

the callback function can look like this:

function yoast_comment($comment, $args, $depth) {
     $GLOBALS['comment'] = $comment;

or whatever you want to output there.


me *Joost de Valk*
Online Marketing, WordPress, SEO & Social Media Strategy
OrangeValley <http://www.orangevalley.nl> & Yoast <http://yoast.com>
E: joost at orangevalley.nl <mailto:joost at orangevalley.nl> - 
joost at yoast.com <mailto:joost at yoast.com>
T: +316-24-555-808 | @jdevalk <http://twitter.com/jdevalk> on Twitter

Simon Wheatley wrote:
> Maybe I'm approaching things wrongly, but the Walker classes make me
> feel uneasy? As I type I'm extending Walker_Comment because I need
> some different markup for my comments and (AFAICT) that means I have
> to extend the Walker_Comment, override the start_el method and then
> pass my new Walker to wp_list_comments. Which seems a pretty
> significant act for what I would expect to be a simple template tweak.
> The root of my disquiet is the amount of markup tangled up in the
> Walker methods... it seems backwards, and is moving away from
> logic/display code separation; not to mention making it non-trivial to
> re-template the comments section. I understand that this is
> complicated recursive code, but surely there's a better way?
> No answers, sorry, just questions...
> Thanks for listening.
> S
> ---
> Sweet Interaction Ltd is Registered in England/Wales, no. 6610741
> Registered office: 7 Malton Av, Manchester, M21 8AT
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list