Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TT2: Make Post Comments block headlines H2s #3150

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 66 additions & 0 deletions src/wp-content/themes/twentytwentytwo/comments.php
@@ -0,0 +1,66 @@
<?php
// Do not delete these lines.
if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
die( 'Please do not load this page directly. Thanks!' );
}

if ( post_password_required() ) { ?>
<p class="nocomments"><?php _e( 'This post is password protected. Enter the password to view comments.' ); ?></p>
<?php
return;
}
?>

<!-- You can start editing here. -->

<?php if ( have_comments() ) : ?>
<h2 id="comments">
<?php
if ( 1 == get_comments_number() ) {
printf(
/* translators: %s: Post title. */
__( 'One response to %s' ),
'&#8220;' . get_the_title() . '&#8221;'
);
} else {
printf(
/* translators: 1: Number of comments, 2: Post title. */
_n( '%1$s response to %2$s', '%1$s responses to %2$s', get_comments_number() ),
number_format_i18n( get_comments_number() ),
'&#8220;' . get_the_title() . '&#8221;'
);
}
?>
</h2>

<div class="navigation">
<div class="alignleft"><?php previous_comments_link(); ?></div>
<div class="alignright"><?php next_comments_link(); ?></div>
</div>

<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>

<div class="navigation">
<div class="alignleft"><?php previous_comments_link(); ?></div>
<div class="alignright"><?php next_comments_link(); ?></div>
</div>
<?php else : // This is displayed if there are no comments so far. ?>

<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->

<?php else : // Comments are closed. ?>
<!-- If comments are closed. -->
<p class="nocomments"><?php _e( 'Comments are closed.' ); ?></p>

<?php endif; ?>
<?php endif; ?>

<?php comment_form(
array(
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h2>',
)
); ?>