comments-guestbook.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * Comments template
  4. *
  5. * @package vamtam/consulting
  6. */
  7. if ( ! defined( 'ABSPATH' ) ) {
  8. die( 'Please do not load this page directly. Thanks!' );
  9. }
  10. ?>
  11. <div class="limit-wrapper vamtam-box-outer-padding">
  12. <?php if ( 'open' === $post->comment_status ) : ?>
  13. <div id="comments">
  14. <div class="respond-box">
  15. <?php if ( get_option( 'comment_registration' ) && ! $user_ID ) : ?>
  16. <p id="login-req"><?php printf( wp_kses_post( __( 'You must be <a href="%s" title="Log in">logged in</a> to post in the Guestbook.', 'vamtam-consulting' ) ), esc_url( get_option( 'siteurl' ) . '/wp-login.php?redirect_to=' . get_permalink() ) ) ?></p>
  17. <?php else : ?>
  18. <?php
  19. $req = get_option( 'require_name_email' );
  20. comment_form( array(
  21. 'title_reply' => '',
  22. 'title_reply_to' => '',
  23. 'fields' => array(
  24. 'author' => '<div class="row"><div class="comment-form-author form-input grid-1-2"><label for="author" class="visuallyhidden">' . esc_html__( 'Name:', 'vamtam-consulting' ) . '</label>' . ( $req ? ' <span class="required">*</span>' : '' ) .
  25. '<input id="author" autocomplete="name" name="author" type="text" ' . ( $req ? 'required="required"' : '' ) . ' value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" placeholder="' . esc_attr__( 'John Doe', 'vamtam-consulting' ) . '" /></div>',
  26. 'email' => '<div class="comment-form-email form-input grid-1-2"><label for="email" class="visuallyhidden">' . esc_html__( 'Email:', 'vamtam-consulting' ) . '</label> ' . ( $req ? ' <span class="required">*</span>' : '' ) . '<span class="comment-note">' . esc_html__( 'Your email address will not be published.', 'vamtam-consulting' ) . '</span>
  27. <input id="email" autocomplete="email" name="email" type="email" ' . ( $req ? 'required="required"' : '' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" placeholder="email@example.com" /></div></div>',
  28. ),
  29. 'comment_field' => '<div class="comment-form-comment grid-1-1"><label for="comment" class="visuallyhidden">' . esc_html__( 'Message:', 'vamtam-consulting' ) . '</label><textarea id="comment" name="comment" required placeholder="' . esc_attr__( 'Write us something nice or just a funny joke...', 'vamtam-consulting' ) . '" rows="2"></textarea></div>',
  30. 'comment_notes_before' => '',
  31. 'comment_notes_after' => '',
  32. 'label_submit' => esc_html__( 'Add message', 'vamtam-consulting' ),
  33. 'format' => 'xhtml', // otherwise we get novalidate on the form
  34. ) );
  35. ?>
  36. <?php endif /* if ( get_option( 'comment_registration' ) && !$user_ID ) */ ?>
  37. </div><!-- .respond-box -->
  38. <?php
  39. $req = get_option( 'require_name_email' ); // Checks if fields are required.
  40. if ( ! empty( $post->post_password ) ) :
  41. if ( post_password_required() ) :
  42. ?>
  43. </div><!-- #comments -->
  44. <?php
  45. return;
  46. endif;
  47. endif;
  48. ?>
  49. <?php if ( have_comments() ) : ?>
  50. <?php // numbers of pings and comments
  51. $ping_count = $comment_count = 0;
  52. foreach ( $comments as $comment ) {
  53. get_comment_type() == 'comment' ? ++$comment_count : ++$ping_count;
  54. }
  55. ?>
  56. <h5 class="comments-title"><?php comments_popup_link( wp_kses_post( __( '0 <span class="comment-word">People wrote to us:</span>', 'vamtam-consulting' ) ), wp_kses_post( __( '1 <span class="comment-word">Person wrote to us:</span>', 'vamtam-consulting' ) ), wp_kses_post( __( '% <span class="comment-word">People wrote to us:</span>', 'vamtam-consulting' ) ) ); ?></h5>
  57. <?php if ( $comment_count ) : ?>
  58. <?php
  59. $cube_options = array(
  60. 'layoutMode' => 'grid',
  61. 'sortToPreventGaps' => true,
  62. 'defaultFilter' => '*',
  63. 'animationType' => 'quicksand',
  64. 'gapHorizontal' => 30,
  65. 'gapVertical' => 30,
  66. 'gridAdjustment' => 'responsive',
  67. 'mediaQueries' => VamtamTemplates::scrollable_columns( 3 ),
  68. 'displayType' => 'bottomToTop',
  69. 'displayTypeSpeed' => 100,
  70. );
  71. wp_enqueue_script( 'cubeportfolio' );
  72. wp_enqueue_style( 'cubeportfolio' );
  73. ?>
  74. <div id="comments-list" class="comments vamtam-comments-small vamtam-cubeportfolio cbp" data-columns="3" data-options="<?php echo esc_attr( json_encode( $cube_options ) ) ?>">
  75. <?php
  76. wp_list_comments( array(
  77. 'avatar_size' => 0,
  78. 'type' => 'comment',
  79. 'reply_allowed' => false,
  80. 'max_depth' => 0,
  81. 'vamtam-layout' => 'small',
  82. 'callback' => array( 'VamtamTemplates', 'comments' ),
  83. 'reverse_top_level' => true,
  84. 'reverse_children' => true,
  85. 'style' => 'div',
  86. ) );
  87. ?>
  88. </div><!-- #comments-list.comments -->
  89. <?php endif; /* if ( $comment_count ) */ ?>
  90. <?php endif /* if ( $comments ) */ ?>
  91. <?php
  92. $comment_pages = paginate_comments_links( array(
  93. 'echo' => false,
  94. ) );
  95. if ( ! empty( $comment_pages ) ) :
  96. ?>
  97. <div class="wp-pagenavi comment-paging"><?php echo $comment_pages // xss ok ?></div>
  98. <?php endif ?>
  99. </div><!-- #comments -->
  100. <?php endif /* if ( 'open' == $post->comment_status ) */ ?>
  101. </div>