• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / Files / comments.php


Lines:

1 to 100 of 134
<?php

/**
 * The template file for displaying the comments and comment form for the
 * Twenty Twenty theme.
 *
 * @package WordPress
 * @subpackage Twenty_Twenty
 * @since Twenty Twenty 1.0
 */

/*
 * If the current post is protected by a password and
 * the visitor has not yet entered the password we will
 * return early without loading the comments.
*/
if ( post_password_required() ) {
  return;
}

if ( $comments ) {
  ?>

	<div class="comments" id="comments">

		<?php
    $comments_number = absint( get_comments_number() );
    ?>

		<div class="comments-header section-inner small max-percentage">

			<h2 class="comment-reply-title">
			<?php
      if ( ! have_comments() ) {
        _e( 'Leave a comment', 'twentytwenty' );
      } elseif ( 1 === $comments_number ) {
        /* translators: %s: Post title. */
        printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentytwenty' ), get_the_title() );
      } else {
        printf(
          /* translators: 1: Number of comments, 2: Post title. */
          _nx(
            '%1$s reply on &ldquo;%2$s&rdquo;',
            '%1$s replies on &ldquo;%2$s&rdquo;',
            $comments_number,
            'comments title',
            'twentytwenty'
          ),
          number_format_i18n( $comments_number ),
          get_the_title()
        );
      }

      ?>
			</h2><!-- .comments-title -->

		</div><!-- .comments-header -->

		<div class="comments-inner section-inner thin max-percentage">

			<?php
      wp_list_comments(
        array(
          'walker'      => new TwentyTwenty_Walker_Comment(),
          'avatar_size' => 120,
          'style'       => 'div',
        )
      );

      $comment_pagination = paginate_comments_links(
        array(
          'echo'      => false,
          'end_size'  => 0,
          'mid_size'  => 0,
          'next_text' => __( 'Newer Comments', 'twentytwenty' ) . ' <span aria-hidden="true">&rarr;</span>',
          'prev_text' => '<span aria-hidden="true">&larr;</span> ' . __( 'Older Comments', 'twentytwenty' ),
        )
      );

      if ( $comment_pagination ) {
        $pagination_classes = '';

        // If we're only showing the "Next" link, add a class indicating so.
        if ( false === strpos( $comment_pagination, 'prev page-numbers' ) ) {
          $pagination_classes = ' only-next';
        }
        ?>

				<nav class="comments-pagination pagination<?php echo $pagination_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>" aria-label="<?php esc_attr_e( 'Comments', 'twentytwenty' ); ?>">
					<?php echo wp_kses_post( $comment_pagination ); ?>
				</nav>

				<?php
      }
      ?>

		</div><!-- .comments-inner -->

	</div><!-- comments -->

	<?php
[1] [2] Next »

 View on GitHub View on Trac

Called by

    Invoked by

      Calls

      Call hooks

      File name: comments.php
      Plugin ref: Twenty Twenty
      Version: 2.1
      Deprecated?: No
      API Letters: C,P

      Published: 25th November 2019 | Last updated: 16th June 2020

      Primary Sidebar

      Information

      File name: comments.php
      Plugin ref: Twenty Twenty
      Version: 2.1
      Deprecated?: No
      API Letters: C,P

      Footer

      WordPress a2z
      WordPress a2z
      WordPress Dynamic API Reference
      WordPress 6.1.1. PHP: 8.0.27
      WordPress a2z
      WordPress core a2z
      Genesis Theme Framework a2z
      Jetpack a2z
      WordPress develop tests
      Easy Digital Downloads a2z
      WooCommerce a2z
      Yoast SEO a2z
      WordPress Blocks

      Site:  wp-a2z.org
      © Copyright WordPress a2z 2014-2023. All rights reserved.


      Website designed and developed by Herb Miller
      Proudly powered by WordPress and oik plugins

      • Home
      • Blog
      • Sitemap
      • Sites