1
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2025-08-18 19:47:25 +08:00
hello-theme/comments.php

79 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2018-11-04 11:13:42 +02:00
<?php
2018-12-19 14:46:42 +02:00
/**
* The template for displaying the list of comments and the comment form.
*
* @package HelloElementor
2018-12-19 14:46:42 +02:00
*/
if ( ! defined( 'ABSPATH' ) ) {
2019-07-11 18:37:10 +03:00
exit; // Exit if accessed directly.
}
2018-11-04 11:13:42 +02:00
if ( ! post_type_supports( get_post_type(), 'comments' ) ) {
return;
}
if ( ! have_comments() && ! comments_open() ) {
return;
}
2019-07-11 18:37:10 +03:00
// Comment Reply Script.
2018-11-04 11:13:42 +02:00
if ( comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
?>
2018-03-19 13:51:18 +02:00
<section id="comments" class="comments-area">
<?php if ( have_comments() ) : ?>
<h2 class="title-comments">
2019-02-12 12:04:43 +02:00
<?php
$comments_number = get_comments_number();
if ( '1' === $comments_number ) {
2019-07-11 18:37:10 +03:00
printf( esc_html_x( 'One Response', 'comments title', 'hello-elementor' ) );
2019-02-12 12:04:43 +02:00
} else {
printf(
/* translators: %s: Number of comments. */
esc_html(
2019-07-11 18:37:10 +03:00
_nx(
'%s Response',
'%s Responses',
2019-07-11 18:37:10 +03:00
$comments_number,
'comments title',
'hello-elementor'
)
2019-02-12 12:04:43 +02:00
),
2019-07-11 18:37:10 +03:00
esc_html( number_format_i18n( $comments_number ) )
2019-02-12 12:04:43 +02:00
);
}
?>
</h2>
2018-03-19 13:51:18 +02:00
2019-07-11 18:37:10 +03:00
<?php the_comments_navigation(); ?>
2018-03-19 13:51:18 +02:00
<ol class="comment-list">
<?php
wp_list_comments(
[
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 42,
]
);
?>
</ol>
2018-03-19 13:51:18 +02:00
2019-07-11 18:37:10 +03:00
<?php the_comments_navigation(); ?>
2018-03-19 13:51:18 +02:00
<?php endif; ?>
2018-03-19 13:51:18 +02:00
<?php
comment_form(
[
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h2>',
]
);
?>
2018-03-19 13:51:18 +02:00
</section>