Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.90 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for displaying Comments.
  4. *
  5. * The area of the page that contains both current comments
  6. * and the comment form. The actual display of comments is
  7. * handled by a callback to generate_comment() which is
  8. * located in the inc/template-tags.php file.
  9. *
  10. * @package GeneratePress
  11. */
  12.  
  13. /*
  14. * If the current post is protected by a password and
  15. * the visitor has not yet entered the password we will
  16. * return early without loading the comments.
  17. */
  18. if ( post_password_required() )
  19. return;
  20. ?>
  21.  
  22. <div id="comments">
  23.  
  24. <?php do_action( 'generate_inside_comments' ); ?>
  25.  
  26. <?php if ( have_comments() ) : ?>
  27. <h3 class="comments-title">
  28. <?php
  29. printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'generate' ),
  30. number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
  31. ?>
  32. </h3>
  33.  
  34. <?php do_action( 'generate_below_comments_title' ); ?>
  35.  
  36. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  37. <nav id="comment-nav-above" class="comment-navigation" role="navigation">
  38. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'generate' ); ?></h1>
  39. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'generate' ) ); ?></div>
  40. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generate' ) ); ?></div>
  41. </nav><!-- #comment-nav-above -->
  42. <?php endif; // check for comment navigation ?>
  43.  
  44. <ol class="comment-list">
  45. <?php
  46. /* Loop through and list the comments. Tell wp_list_comments()
  47. * to use generate_comment() to format the comments.
  48. * If you want to override this in a child theme, then you can
  49. * define generate_comment() and that will be used instead.
  50. * See generate_comment() in inc/template-tags.php for more.
  51. */
  52. wp_list_comments( array(
  53. 'callback' => 'generate_comment'
  54. ) );
  55. ?>
  56. </ol><!-- .comment-list -->
  57.  
  58. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
  59. <nav id="comment-nav-below" class="comment-navigation" role="navigation">
  60. <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'generate' ); ?></h1>
  61. <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'generate' ) ); ?></div>
  62. <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generate' ) ); ?></div>
  63. </nav><!-- #comment-nav-below -->
  64. <?php endif; // check for comment navigation ?>
  65.  
  66. <?php endif; // have_comments() ?>
  67.  
  68. <?php
  69. // If comments are closed and there are comments, let's leave a little note, shall we?
  70. if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
  71. ?>
  72. <p class="no-comments"><?php _e( 'Comments are closed.', 'generate' ); ?></p>
  73. <?php endif;
  74.  
  75. $commenter = wp_get_current_commenter();
  76. $fields = array(
  77. 'author' => '<input placeholder="' . __( 'Name','generate' ) . ' *" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" />',
  78. 'email' => '<input placeholder="' . __( 'Email','generate' ) . ' *" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" />',
  79. 'url' => '<input placeholder="' . __( 'Website','generate' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />',
  80. );
  81. $defaults = array(
  82. 'fields' => apply_filters( 'comment_form_default_fields', $fields ),
  83. 'comment_field' => '<p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
  84. 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%1$s">logged in</a> to post a comment.','generate' ), wp_login_url( get_permalink() ) ) . '</p>',
  85. 'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>','generate' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( get_permalink() ) ) . '</p>',
  86. 'comment_notes_before' => null,
  87. 'comment_notes_after' => null,
  88. 'id_form' => 'commentform',
  89. 'id_submit' => 'submit',
  90. 'title_reply' => apply_filters( 'generate_leave_comment', __( 'Leave a Comment','generate' ) ),
  91. 'title_reply_to' => apply_filters( 'generate_leave_reply', __( 'Leave a Reply to %s','generate' ) ),
  92. 'cancel_reply_link' => apply_filters( 'generate_cancel_reply', __( 'Cancel reply','generate' ) ),
  93. 'label_submit' => apply_filters( 'generate_post_comment', __( 'Post Comment','generate' ) ),
  94. );
  95. comment_form($defaults);
  96. ?>
  97.  
  98. </div><!-- #comments -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement