have_comments example

<?php bloginfo_rss( 'comments_atom_url' ); ?></id> <?php endif; ?> <?php     /** * Fires at the end of the Atom comment feed header. * * @since 2.8.0 */
    do_action( 'comments_atom_head' );
?> <?php while ( have_comments() ) :
    the_comment();
    $comment_post    = get_post( $comment->comment_post_ID );
    $GLOBALS['post'] = $comment_post;
    ?> <entry> <title> <?php         if ( ! is_singular() ) {
            $title = get_the_title( $comment_post->ID );
            /** This filter is documented in wp-includes/feed.php */
            $title = apply_filters( 'the_title_rss', $title );
            
echo apply_filters( 'rss_update_frequency', '1' );
    ?> </sy:updateFrequency> <?php     /** * Fires at the end of the RSS2 comment feed header. * * @since 2.3.0 */
    do_action( 'commentsrss2_head' );

    while ( have_comments() ) :
        the_comment();
        $comment_post    = get_post( $comment->comment_post_ID );
        $GLOBALS['post'] = $comment_post;
        ?> <item> <title> <?php         if ( ! is_singular() ) {
            $title = get_the_title( $comment_post->ID );
            /** This filter is documented in wp-includes/feed.php */
            $title = apply_filters( 'the_title_rss', $title );
            

if ( post_password_required() ) {
    return;
}

$twenty_twenty_one_comment_count = get_comments_number();
?> <div id="comments" class="comments-area default-max-width <?php echo get_option( 'show_avatars' ) ? 'show-avatars' : ''; ?>"> <?php     if ( have_comments() ) :
        ?> <h2 class="comments-title"> <?php if ( '1' === $twenty_twenty_one_comment_count ) : ?> <?php esc_html_e( '1 comment', 'twentytwentyone' ); ?> <?php else : ?> <?php                 printf(
                    /* translators: %s: Comment count number. */
                    esc_html( _nx( '%s comment', '%s comments', $twenty_twenty_one_comment_count, 'Comments title', 'twentytwentyone' ) ),
                    esc_html( number_format_i18n( $twenty_twenty_one_comment_count ) )
                );
                


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() ) : ?> <h3 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. */
                

function have_comments() {
    global $wp_query;

    if ( ! isset( $wp_query ) ) {
        return false;
    }

    return $wp_query->have_comments();
}

/** * Iterate comment index in the comment loop. * * @since 2.2.0 * * @global WP_Query $wp_query WordPress Query object. */
function the_comment() {
    global $wp_query;

    
Home | Imprint | This part of the site doesn't use cookies.