wp_comment_reply

Outputs the in-line comment reply-to form in the Comments list table.

Description

wp_comment_reply( (int) $position = 1, (constant) $checkbox = false, (string) $mode = 'single', (bool) $table_row = true ); 

Parameters (4)

0. $position — Optional. (int) => 1
The position.
1. $checkbox — Optional. (constant) => false
The checkbox.
2. $mode — Optional. (string) => 'single'
The mode.
3. $table_row — Optional. (bool) => true
The table row.

Usage

  1. if ( !function_exists( 'wp_comment_reply' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/template.php'; 
  3.  
  4. // The position. 
  5. $position = 1; 
  6.  
  7. // The checkbox. 
  8. $checkbox = false; 
  9.  
  10. // The mode. 
  11. $mode = 'single'; 
  12.  
  13. // The table row. 
  14. $table_row = true; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wp_comment_reply($position, $checkbox, $mode, $table_row); 
  18.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/template.php  
  1. function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) { 
  2. global $wp_list_table; 
  3. /** 
  4. * Filters the in-line comment reply-to form output in the Comments 
  5. * list table. 
  6. * Returning a non-empty value here will short-circuit display 
  7. * of the in-line comment-reply form in the Comments list table,  
  8. * echoing the returned value instead. 
  9. * @since 2.7.0 
  10. * @see wp_comment_reply() 
  11. * @param string $content The reply-to form content. 
  12. * @param array $args An array of default args. 
  13. */ 
  14. $content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode ) ); 
  15.  
  16. if ( ! empty($content) ) { 
  17. echo $content; 
  18. return; 
  19.  
  20. if ( ! $wp_list_table ) { 
  21. if ( $mode == 'single' ) { 
  22. } else { 
  23. $wp_list_table = _get_list_table('WP_Comments_List_Table'); 
  24.  
  25. ?> 
  26. <form method="get"> 
  27. <?php if ( $table_row ) : ?> 
  28. <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange"> 
  29. <?php else : ?> 
  30. <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;"> 
  31. <?php endif; ?> 
  32. <fieldset class="comment-reply"> 
  33. <legend> 
  34. <span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span> 
  35. <span class="hidden" id="replyhead"><?php _e( 'Reply to Comment' ); ?></span> 
  36. <span class="hidden" id="addhead"><?php _e( 'Add new Comment' ); ?></span> 
  37. </legend> 
  38.  
  39. <div id="replycontainer"> 
  40. <label for="replycontent" class="screen-reader-text"><?php _e( 'Comment' ); ?></label> 
  41. <?php 
  42. $quicktags_settings = array( 'buttons' => 'strong, em, link, block, del, ins, img, ul, ol, li, code, close' ); 
  43. wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) ); 
  44. ?> 
  45. </div> 
  46.  
  47. <div id="edithead" style="display:none;"> 
  48. <div class="inside"> 
  49. <label for="author-name"><?php _e( 'Name' ) ?></label> 
  50. <input type="text" name="newcomment_author" size="50" value="" id="author-name" /> 
  51. </div> 
  52.  
  53. <div class="inside"> 
  54. <label for="author-email"><?php _e('Email') ?></label> 
  55. <input type="text" name="newcomment_author_email" size="50" value="" id="author-email" /> 
  56. </div> 
  57.  
  58. <div class="inside"> 
  59. <label for="author-url"><?php _e('URL') ?></label> 
  60. <input type="text" id="author-url" name="newcomment_author_url" class="code" size="103" value="" /> 
  61. </div> 
  62. </div> 
  63.  
  64. <p id="replysubmit" class="submit"> 
  65. <a href="#comments-form" class="save button button-primary alignright"> 
  66. <span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span> 
  67. <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span> 
  68. <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a> 
  69. <a href="#comments-form" class="cancel button alignleft"><?php _e('Cancel'); ?></a> 
  70. <span class="waiting spinner"></span> 
  71. <span class="error" style="display:none;"></span> 
  72. </p> 
  73.  
  74. <input type="hidden" name="action" id="action" value="" /> 
  75. <input type="hidden" name="comment_ID" id="comment_ID" value="" /> 
  76. <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" /> 
  77. <input type="hidden" name="status" id="status" value="" /> 
  78. <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" /> 
  79. <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" /> 
  80. <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" /> 
  81. <?php 
  82. wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false ); 
  83. if ( current_user_can( 'unfiltered_html' ) ) 
  84. wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false ); 
  85. ?> 
  86. </fieldset> 
  87. <?php if ( $table_row ) : ?> 
  88. </td></tr></tbody></table> 
  89. <?php else : ?> 
  90. </div></div> 
  91. <?php endif; ?> 
  92. </form> 
  93. <?php