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

git-svn-id: http://svn.automattic.com/wordpress/trunk@20010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
lancewillett 2012-02-28 05:24:57 +00:00
parent 146e6e6b8a
commit 240242aa06
3 changed files with 244 additions and 35 deletions

View File

@ -44,8 +44,8 @@
<?php endif; // check for comment navigation ?>
<ol class="commentlist">
<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment' ) ); ?>
</ol>
<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?>
</ol><!-- .commentlist -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-below" role="navigation">

View File

@ -261,55 +261,47 @@ function twentytwelve_comment( $comment, $args, $depth ) {
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
<?php
break;
default :
// Proceed with normal comments.
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment">
<footer class="comment-meta">
<div class="comment-author vcard">
<?php
$avatar_size = 68;
if ( '0' != $comment->comment_parent )
$avatar_size = 39;
<header class="comment-meta comment-author vcard">
<?php
echo get_avatar( $comment, 44 );
echo get_avatar( $comment, $avatar_size );
printf( '<cite class="fn">%s</cite>', get_comment_author_link() );
printf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
);
?>
<?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
</header>
/* translators: 1: comment author, 2: date and time */
printf( __( '%1$s on %2$s <span class="says">said:</span>', 'twentytwelve' ),
sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
)
);
?>
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></p>
<?php endif; ?>
<?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></em>
<br />
<?php endif; ?>
</footer>
<div class="comment-content"><?php comment_text(); ?></div>
<section class="comment post-content">
<?php comment_text(); ?>
</section>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span>&darr;</span>', 'twentytwelve' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</article><!-- #comment-## -->
<?php
break;
endswitch;
break;
endswitch; // end comment_type check
}
endif;

View File

@ -558,6 +558,223 @@ video {
max-width: 100%;
}
/* comments.css.scss
* Comment styling
* ------------------------------------------------------------------ */
#comments-title {
margin-bottom: 48px;
margin-bottom: 3.428571429rem;
font-size: 16px;
font-size: 1.142857143rem;
line-height: 1.5;
font-weight: normal;
}
#comments article {
zoom: 1;
margin: 24px 0;
margin: 1.714285714rem 0;
}
#comments article:before, #comments article:after {
display: table;
content: "";
}
#comments article:after {
clear: both;
}
#comments article header {
position: relative;
zoom: 1;
margin: 0 0 48px 0;
margin: 0 0 3.428571429rem 0;
}
#comments article header:before, #comments article header:after {
display: table;
content: "";
}
#comments article header:after {
clear: both;
}
#comments article header img {
float: left;
padding: 0;
line-height: 0;
}
#comments article header cite,
#comments article header time {
display: block;
margin-left: 85px;
margin-left: 6.071428571rem;
}
#comments article header cite {
font-style: normal;
font-size: 15px;
font-size: 1.071428571rem;
line-height: 1.6;
}
#comments article header time {
line-height: 1.714285714;
text-decoration: none;
font-size: 12px;
font-size: 0.857142857rem;
color: #5e5e5e;
}
#comments article header a {
text-decoration: none;
color: #5e5e5e;
}
#comments article header a:hover {
color: #13609e;
}
#comments article header cite a {
color: #444444;
}
#comments article header cite a:hover {
text-decoration: underline;
}
#comments article header h4 {
position: absolute;
top: 0;
right: 0;
padding: 6px 12px;
padding: 0.428571429rem 0.857142857rem;
font-size: 12px;
font-size: 0.857142857rem;
font-weight: normal;
color: #fff;
background-color: #0088d0;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#009cee), to(#0088d0));
background-image: -moz-linear-gradient(top, #009cee, #0088d0);
background-image: -ms-linear-gradient(top, #009cee, #0088d0);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #009cee), color-stop(100%, #0088d0));
background-image: -webkit-linear-gradient(top, #009cee, #0088d0);
background-image: -o-linear-gradient(top, #009cee, #0088d0);
background-image: linear-gradient(top, #009cee, #0088d0);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: 1px solid #007cbd;
}
#comments article p {
margin: 24px 0;
margin: 1.714285714rem 0;
line-height: 1.714285714;
}
a.comment-reply-link {
font-size: 13px;
font-size: 0.928571429rem;
line-height: 1.846153846;
color: #686868;
}
a.comment-reply-link:hover {
color: #13609e;
}
/*---------------------------------------------------------
Form
------------------------------------------------------------ */
#respond {
margin-top: 48px;
margin-top: 3.428571429rem;
}
#respond h3#reply-title {
font-size: 16px;
font-size: 1.142857143rem;
line-height: 1.5;
}
#respond h3#reply-title #cancel-comment-reply-link {
margin-left: 10px;
margin-left: 0.714285714rem;
font-weight: normal;
font-size: 12px;
font-size: 0.857142857rem;
}
#respond form {
margin: 24px 0;
margin: 1.714285714rem 0;
}
#respond form p {
zoom: 1;
margin: 11px 0;
margin: 0.785714286rem 0;
}
#respond form p:before, #respond form p:after {
display: table;
content: "";
}
#respond form p:after {
clear: both;
}
#respond form p.logged-in-as {
margin-bottom: 24px;
margin-bottom: 1.714285714rem;
}
#respond form label {
display: block;
line-height: 1.714285714;
}
#respond form input[type="text"],
#respond form textarea {
font-family: inherit;
line-height: 1.714285714;
padding: 10px;
padding: 0.714285714rem;
border: 1px solid #d5d2ca;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
width: 96%;
}
@media screen and (min-width: 600px) {
#respond form input[type="text"] {
width: 46.333333333%;
}
#respond form textarea.blog-textarea {
width: 79.666666667%;
}
}
#respond form p.form-allowed-tags {
margin: 0;
font-size: 12px;
font-size: 0.857142857rem;
line-height: 2;
color: #5e5e5e;
}
/* widgets.css.scss
* All widget styling
* ------------------------------------------------------------------ */
#wp-calendar {
margin: 0;
width: 100%;
font-size: 13px;
font-size: 0.928571429rem;
line-height: 1.846153846;
color: #686868;
}
#wp-calendar th,
#wp-calendar td,
#wp-calendar caption {
text-align: left;
}
.widget_search label {
display: block;
font-size: 13px;
font-size: 0.928571429rem;
line-height: 1.846153846;
}
.widget_search input[type="text"] {
padding: 6px;
padding: 0.428571429rem;
border: 1px solid #ccc;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
/* archive.css.scss
* Styling for the archive view
* ------------------------------------------------------------------ */