portage/comments.php

76 lines
2.6 KiB
PHP
Raw Permalink Normal View History

2021-08-01 17:32:46 +00:00
<div id="comments">
<?php if ( have_comments() ) : ?>
2021-08-01 17:53:44 +00:00
<?php do_action( 'portage_before_comments' ); ?>
2021-08-01 17:32:46 +00:00
<?php
if ( post_password_required() ) {
echo '<p class="nocomments">This post is password protected. Enter the password to view comments.</p>';
return;
}
?>
<!-- Actual comments are listed here -->
<h3 class="comments-title">
<?php
$post_comments = count( get_comments(array('type' => 'comment','post_id' => $post->ID)) );
2021-08-01 17:53:44 +00:00
printf( _nx( 'One comment on &ldquo;%2$s&rdquo;', '%1$s comments on &ldquo;%2$s&rdquo;', $post_comments, 'comments title', 'portage' ),
2021-08-01 17:32:46 +00:00
number_format_i18n( $post_comments ), '<span>' . get_the_title() . '</span>' );
?>
</h3>
<ol class="comment-list">
<?php
wp_list_comments( array(
'style' => 'div',
'short_ping' => false,
'avatar_size' => 32,
'type' => 'comment',
'format' => 'xhtml',
) );
?>
</ol><!-- .comment-list -->
<!-- Pingbacks and trackbacks are listed here -->
<h3 class="comments-title">
<?php
$post_pings = count( get_comments(array( 'type' => 'pings', 'post_id' => $post->ID )) );
if ( $post_pings > 0 ) {
2021-08-01 17:53:44 +00:00
printf( _nx( 'One pingback/trackback on &ldquo;%2$s&rdquo;', '%1$s pingbacks/trackbacks on &ldquo;%2$s&rdquo;', $post_pings, 'pingbacks title', 'portage' ),
2021-08-01 17:32:46 +00:00
number_format_i18n( $post_pings ), '<span>' . get_the_title() . '</span>' );
}
?>
</h3>
<ol class="comment-list">
<?php
wp_list_comments( array(
'style' => 'div',
'short_ping' => true,
'avatar_size' => 0,
'type' => 'pings',
'format' => 'xhtml',
) );
?>
</ol><!-- .comment-list -->
<?php
// Are there comments to navigate through?
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
?>
<nav class="navigation comment-navigation" role="navigation">
2021-08-01 17:53:44 +00:00
<h1 class="screen-reader-text section-heading"><?php _e( 'Comment navigation', 'portage' ); ?></h1>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'portage' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'portage' ) ); ?></div>
2021-08-01 17:32:46 +00:00
</nav><!-- .comment-navigation -->
<?php endif; // Check for comment navigation ?>
<?php if ( ! comments_open() && get_comments_number() ) : ?>
2021-08-01 17:53:44 +00:00
<p class="no-comments"><?php _e( 'Sorry, but comments are closed.' , 'portage' ); ?></p>
2021-08-01 17:32:46 +00:00
<?php endif; ?>
2021-08-01 17:53:44 +00:00
<?php do_action( 'portage_after_comments' ); ?>
2021-08-01 17:32:46 +00:00
<?php endif; // have_comments() ?>
2021-08-01 17:53:44 +00:00
<?php do_action( 'portage_before_comment_form' ) ?>
2021-08-01 17:32:46 +00:00
<?php comment_form(); ?>
2021-08-01 17:53:44 +00:00
<?php do_action( 'portage_after_comment_form' ) ?>
</div>