Created
November 17, 2012 21:43
-
-
Save tddewey/4100522 to your computer and use it in GitHub Desktop.
Explaining comment_reply_link nuance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Very simplified comment callback to illustrate one particular nuance. Yours should be more robust. | |
* | |
* param $comment object The comments object | |
* param $args array Array of parameters passed to wp_list_comments | |
* param $depth integer How deep we are in the nested comments | |
*/ | |
function tdd_demo_comments_callback( $comment, $args, $depth ) { | |
?> | |
<li <?php comment_class() ?> id="comment-<?php comment_ID(); ?>"> | |
<div id="div-comment-<?php comment_ID(); ?>" class="comment-body cf"> | |
<?php // Do whatever output of the comment info ?> | |
<?php comment_reply_link( array_merge( $args, array( 'add_below' => 'comment-footer' ) ); ?> | |
</div> | |
<div> | |
<?php // For the example, say we're outputting other stuff, perhaps an avatar here ?> | |
</div> | |
<div id="comment-footer-<?php comment_ID(); ?>" class="comment-footer"> | |
<?php // maybe something else here ?> | |
</div> | |
<?php // When it's moved by the javascript, the comment form will be inserted here ?> | |
</li> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment