Guest User

Untitled

a guest
Jan 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?php
  2.  
  3. $fields = array(
  4. 'author' =>
  5. '<div class="col-md-4 comment-form-author">' .
  6. '<input placeholder="'.__( 'Name', '_lp' ).' '.( $req ? ' ( Required )' : '' ) .'" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
  7. '" size="30"' . $aria_req . ' /></div>',
  8.  
  9. 'email' =>
  10. '<div class="col-md-4 comment-form-email">'.
  11. '<input placeholder="'.__( 'Email', '_lp' ).' '.( $req ? ' ( Required )' : '' ) .'" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) .
  12. '" size="30"' . $aria_req . ' /></div>',
  13.  
  14. 'url' =>
  15. '<div class="col-md-4 comment-form-url">' .
  16. '<input placeholder="'.__( 'Website', '_lp' ).' '.( $req ? ' ( Required )' : '' ) .'" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) .
  17. '" size="30" /></div>',
  18. );
  19. ?>
  20.  
  21. //for the comment wrapping functions - ensures HTML does not break.
  22. $comment_open_div = 0;
  23.  
  24. /**
  25. * Creates an opening div for a bootstrap row.
  26. * @global int $comment_open_div
  27. */
  28. function _lp_before_comment_fields(){
  29. global $comment_open_div;
  30. $comment_open_div = 1;
  31. echo '<div class="row">';
  32. }
  33. /**
  34. * Creates a closing div for a bootstrap row.
  35. * @global int $comment_open_div
  36. * @return type
  37. */
  38. function _lp_after_comment_fields(){
  39. global $comment_open_div;
  40. if($comment_open_div == 0)
  41. return;
  42. echo '</div>';
  43. }
  44.  
  45. add_action('comment_form_before_fields', '_lp_before_comment_fields');
  46. add_action('comment_form_after_fields', '_lp_after_comment_fields');
  47.  
  48. <div class="row">
  49. <!--the fields and stuff-->
  50. </div>
  51.  
  52. function wpse172052_comment_form_before_fields() {
  53. echo '<div class="row">';
  54. }
  55. add_action('comment_form_before_fields', 'wpse172052_comment_form_before_fields');
  56.  
  57. function wpse172052_comment_form_after_fields() {
  58. echo '</div>';
  59. }
  60. add_action('comment_form_after_fields', 'wpse172052_comment_form_after_fields');
Add Comment
Please, Sign In to add comment