Make WordPress Core


Ignore:
Timestamp:
02/28/2012 05:24:57 AM (15 years ago)
Author:
lancewillett
Message:

Twenty Twelve: better comment markup and styles, props drewstrojny. See #19978.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/functions.php

    r20007 r20010  
    262262                case 'pingback' :
    263263                case 'trackback' :
    264         ?>
    265         <li class="post pingback">
    266                 <p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
     264                // Display trackbacks differently than normal comments.
     265        ?>
     266        <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
     267                <p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
    267268        <?php
    268269                        break;
    269270                default :
     271                // Proceed with normal comments.
    270272        ?>
    271273        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    272274                <article id="comment-<?php comment_ID(); ?>" class="comment">
    273                         <footer class="comment-meta">
    274                                 <div class="comment-author vcard">
    275                                         <?php
    276                                                 $avatar_size = 68;
    277                                                 if ( '0' != $comment->comment_parent )
    278                                                         $avatar_size = 39;
    279 
    280                                                 echo get_avatar( $comment, $avatar_size );
    281 
    282                                                 /* translators: 1: comment author, 2: date and time */
    283                                                 printf( __( '%1$s on %2$s <span class="says">said:</span>', 'twentytwelve' ),
    284                                                         sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
    285                                                         sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
    286                                                                 esc_url( get_comment_link( $comment->comment_ID ) ),
    287                                                                 get_comment_time( 'c' ),
    288                                                                 /* translators: 1: date, 2: time */
    289                                                                 sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
    290                                                         )
    291                                                 );
    292                                         ?>
    293 
    294                                         <?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
    295                                 </div><!-- .comment-author .vcard -->
    296 
    297                                 <?php if ( $comment->comment_approved == '0' ) : ?>
    298                                         <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></em>
    299                                         <br />
    300                                 <?php endif; ?>
    301                         </footer>
    302 
    303                         <div class="comment-content"><?php comment_text(); ?></div>
     275                        <header class="comment-meta comment-author vcard">
     276                                <?php
     277                                        echo get_avatar( $comment, 44 );
     278
     279                                        printf( '<cite class="fn">%s</cite>', get_comment_author_link() );
     280                                        printf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
     281                                                esc_url( get_comment_link( $comment->comment_ID ) ),
     282                                                get_comment_time( 'c' ),
     283                                                /* translators: 1: date, 2: time */
     284                                                sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
     285                                        );
     286                                ?>
     287                                <?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
     288                        </header>
     289
     290                        <?php if ( '0' == $comment->comment_approved ) : ?>
     291                                <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></p>
     292                        <?php endif; ?>
     293
     294                        <section class="comment post-content">
     295                                <?php comment_text(); ?>
     296                        </section>
    304297
    305298                        <div class="reply">
    … …  
    307300                        </div><!-- .reply -->
    308301                </article><!-- #comment-## -->
    309 
    310         <?php
    311                         break;
    312         endswitch;
     302        <?php
     303                break;
     304        endswitch; // end comment_type check
    313305}
    314306endif;
Note: See TracChangeset for help on using the changeset viewer.