comments.php
<?php
$args=array(
'type'=> 'comment',
'callback'=>'my_comment_list',
);
?>
<ol class="comments-list">
<?php wp_list_comments($args) ?>
</ol>
function.php
function my_comment_list($comment,$arg,$depth){
}
When trying to create a callback function called my_comment_list, it looks like I need three types of arguments for the callback function, $ comment, $ arg, $ depth
,
My question is:
How do you know you need these arguments for callback function? and Where do you get detailed explanations of arguments, etc.?
I usually refer to the below link in Wordpress template tags and functions, but It was not there...
Wordpress Developer Resource
comments.php
<?php
$args=array(
'type'=> 'comment',
'callback'=>'my_comment_list',
);
?>
<ol class="comments-list">
<?php wp_list_comments($args) ?>
</ol>
function.php
function my_comment_list($comment,$arg,$depth){
}
When trying to create a callback function called my_comment_list, it looks like I need three types of arguments for the callback function, $ comment, $ arg, $ depth
,
My question is:
How do you know you need these arguments for callback function? and Where do you get detailed explanations of arguments, etc.?
I usually refer to the below link in Wordpress template tags and functions, but It was not there...
Wordpress Developer Resource
Share Improve this question asked Apr 11, 2020 at 6:24 Kazu25Kazu25 331 silver badge7 bronze badges1 Answer
Reset to default 2wp_list_comments()
uses Walker_Comment
class to render the output.
See Walker_Comment->start_el()
method for callback argument:
https://developer.wordpress/reference/classes/walker_comment/start_el/
And Walker_Comment->end_el()
method for end-callback argument:
https://developer.wordpress/reference/classes/walker_comment/end_el/