PageRenderTime 26ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/Project/faci-qsoft/wp-content/themes/Avada/comments.php

https://gitlab.com/hop23typhu/list-theme
PHP | 74 lines | 51 code | 17 blank | 6 comment | 8 complexity | 269a3f0923190d23130581e7485d7ca4 MD5 | raw file
  1. <?php
  2. /*
  3. * If the current post is protected by a password and
  4. * the visitor has not yet entered the password we will
  5. * return early without loading the comments.
  6. */
  7. if ( post_password_required() ) {
  8. return;
  9. }
  10. if ( have_comments() ) : ?>
  11. <div id="comments" class="comments-container">
  12. <?php
  13. ob_start();
  14. comments_number( __( 'No Comments', 'Avada' ), __( 'One Comment', 'Avada' ), '% ' . __( 'Comments', 'Avada' ) );
  15. echo Avada()->template->title_template( ob_get_clean(), '3' );
  16. if( function_exists( 'the_comments_navigation' ) ) {
  17. the_comments_navigation();
  18. }
  19. ?>
  20. <ol class="comment-list commentlist">
  21. <?php wp_list_comments( 'callback=avada_comment' ); ?>
  22. </ol><!-- .comment-list -->
  23. <?php
  24. if( function_exists( 'the_comments_navigation' ) ) {
  25. the_comments_navigation();
  26. }
  27. ?>
  28. </div>
  29. <?php endif;
  30. if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
  31. <p class="no-comments"><?php echo __( 'Comments are closed.', 'Avada' ); ?></p>
  32. <?php endif;
  33. if ( comments_open() ) :
  34. $commenter = wp_get_current_commenter();
  35. $req = get_option( 'require_name_email' );
  36. $aria_req = ( $req ? " aria-required='true'" : '' );
  37. $html_req = ( $req ? " required='required'" : '' );
  38. $html5 = 'html5' === current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
  39. $fields = array();
  40. $fields['author'] = '<div id="comment-input"><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" placeholder="' . __( 'Name (required)', 'Avada' ) . '" size="30"' . $aria_req . $html_req . ' />';
  41. $fields['email'] = '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" placeholder="' . __( 'Email (required)', 'Avada' ) . '" size="30" aria-describedby="email-notes"' . $aria_req . $html_req . ' />';
  42. $fields['url'] = '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" placeholder="' . __( 'Website', 'Avada' ) . '" size="30" /></div>';
  43. $comments_args = array(
  44. 'fields' => apply_filters( 'comment_form_default_fields', $fields ),
  45. 'comment_field' => '<div id="comment-textarea"><textarea name="comment" id="comment" cols="45" rows="8" aria-required="true" required="required" tabindex="4" class="textarea-comment" placeholder="' . __( 'Comment...', 'Avada' ) . '"></textarea></div>',
  46. 'title_reply' => __( 'Leave A Comment', 'Avada' ),
  47. 'title_reply_to' => __( 'Leave A Comment', 'Avada' ),
  48. 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be %slogged in%s to post a comment.', 'Avada' ), '<a href="' . wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) . '">', '</a>' ) . '</p>',
  49. 'logged_in_as' => '<p class="logged-in-as">' . __( 'Logged in as', 'Avada' ) . ' <a href="' . admin_url( 'profile.php' ) . '">' . $user_identity . '</a>. <a href="' . wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) ) . '" title="' . __( 'Log out of this account', 'Avada' ) . '">' . __( 'Log out &raquo;', 'Avada' ) . '</a></p>',
  50. 'comment_notes_before' => '',
  51. 'id_submit' => 'comment-submit',
  52. 'class_submit' => 'fusion-button fusion-button-default',
  53. 'label_submit' => __( 'Post Comment', 'Avada' ),
  54. );
  55. comment_form( $comments_args );
  56. endif;
  57. // Omit closing PHP tag to avoid "Headers already sent" issues.