[wp-hackers] Uneasy over the Walkers

Otto otto at ottodestruct.com
Thu Mar 26 18:16:17 GMT 2009


Yes, the callback is the easiest way if you want to mess with the
markup itself, but really, you should consider whether or not it is
necessary to mess with the markup first. Okay, in some cases it's
unavoidable, but ideally, most anything you want to change should be
editable via either CSS or filters.

If you want to use some wholly different style for comments, then you
should consider whether or not it might be better to attempt using the
default style first. There's significant advantages to standardizing
comment display markup, and sticking to the "standard" is much
preferred.

-Otto
Sent from: Memphis Tennessee United States.


On Thu, Mar 26, 2009 at 10:25 AM, Joost de Valk <joost at yoast.com> wrote:
> 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;
>    comment_text();
> }
>
> or whatever you want to output there.
>
> Best,
> Joost
>
>
> 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
>>
>
> _______________________________________________
> 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