Twenty Eleven code review and cleanup, props dd32, fixes #17748

git-svn-id: http://svn.automattic.com/wordpress/trunk@18253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-06-10 23:01:16 +00:00
parent bfe6bef203
commit 3a29a3d893
11 changed files with 17 additions and 42 deletions

View File

@ -17,17 +17,6 @@ get_header(); ?>
<section id="primary"> <section id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php
/* Queue the first post, that way we know
* what date we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
if ( have_posts() )
the_post();
?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"> <h1 class="page-title">
<?php if ( is_day() ) : ?> <?php if ( is_day() ) : ?>
@ -42,14 +31,6 @@ get_header(); ?>
</h1> </h1>
</header> </header>
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
?>
<?php twentyeleven_content_nav( 'nav-above' ); ?> <?php twentyeleven_content_nav( 'nav-above' ); ?>
<?php /* Start the Loop */ ?> <?php /* Start the Loop */ ?>

View File

@ -14,7 +14,7 @@ get_header(); ?>
<?php <?php
/* Queue the first post, that way we know /* Queue the first post, that way we know
* what date we're dealing with (if that is the case). * what author we're dealing with (if that is the case).
* *
* We reset this later so we can run the loop * We reset this later so we can run the loop
* properly with a call to rewind_posts(). * properly with a call to rewind_posts().

View File

@ -17,7 +17,7 @@
<h2 class="entry-format"><?php _e( 'Aside', 'twentyeleven' ); ?></h2> <h2 class="entry-format"><?php _e( 'Aside', 'twentyeleven' ); ?></h2>
</hgroup> </hgroup>
<?php if ( 'post' == $post->post_type ) : ?> <?php if ( 'post' == get_post_type() ) : ?>
<?php endif; ?> <?php endif; ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>

View File

@ -29,7 +29,7 @@
</div><!-- .entry-content --> </div><!-- .entry-content -->
<footer class="entry-meta"> <footer class="entry-meta">
<?php if ( 'post' == $post->post_type ) : // Hide category and tag text for pages on Search ?> <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
<div class="entry-meta"> <div class="entry-meta">
<?php <?php
printf( __( '<a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span></span>', 'twentyeleven' ), printf( __( '<a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span></span>', 'twentyeleven' ),

View File

@ -17,7 +17,7 @@
<h2 class="entry-format"><?php _e( 'Link', 'twentyeleven' ); ?></h2> <h2 class="entry-format"><?php _e( 'Link', 'twentyeleven' ); ?></h2>
</hgroup> </hgroup>
<?php if ( 'post' == $post->post_type ) : ?> <?php if ( 'post' == get_post_type() ) : ?>
<?php endif; ?> <?php endif; ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>

View File

@ -15,7 +15,7 @@
<h2 class="entry-format"><?php _e( 'Quote', 'twentyeleven' ); ?></h2> <h2 class="entry-format"><?php _e( 'Quote', 'twentyeleven' ); ?></h2>
</hgroup> </hgroup>
<?php if ( 'post' == $post->post_type ) : ?> <?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta"> <div class="entry-meta">
<?php twentyeleven_posted_on(); ?> <?php twentyeleven_posted_on(); ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
@ -41,7 +41,7 @@
<footer class="entry-meta"> <footer class="entry-meta">
<?php $show_sep = false; ?> <?php $show_sep = false; ?>
<?php if ( 'post' == $post->post_type ) : // Hide category and tag text for pages on Search ?> <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
<?php <?php
/* translators: used between list items, there is a space after the comma */ /* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) ); $categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );

View File

@ -12,9 +12,11 @@
<header class="entry-header"> <header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1> <h1 class="entry-title"><?php the_title(); ?></h1>
<?php if ( 'post' == get_post_type() ) : /* Bit of a disconnect here, Some files include this test, not all do. */ ?>
<div class="entry-meta"> <div class="entry-meta">
<?php twentyeleven_posted_on(); ?> <?php twentyeleven_posted_on(); ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header --> </header><!-- .entry-header -->
<div class="entry-content"> <div class="entry-content">

View File

@ -16,9 +16,6 @@
<h2 class="entry-format"><?php _e( 'Status', 'twentyeleven' ); ?></h2> <h2 class="entry-format"><?php _e( 'Status', 'twentyeleven' ); ?></h2>
</hgroup> </hgroup>
<?php if ( 'post' == $post->post_type ) : ?>
<?php endif; ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>
<div class="comments-link"> <div class="comments-link">
<?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?> <?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?>
@ -32,7 +29,7 @@
</div><!-- .entry-summary --> </div><!-- .entry-summary -->
<?php else : ?> <?php else : ?>
<div class="entry-content"> <div class="entry-content">
<div class="avatar"><?php echo get_avatar( $post->post_author, apply_filters( 'twentyeleven_status_avatar', '65' ) ); ?></div> <div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'twentyeleven_status_avatar', '65' ) ); ?></div>
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyeleven' ), 'after' => '</div>' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyeleven' ), 'after' => '</div>' ) ); ?>

View File

@ -12,14 +12,14 @@
<header class="entry-header"> <header class="entry-header">
<?php if ( is_sticky() ) : ?> <?php if ( is_sticky() ) : ?>
<hgroup> <hgroup>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1> <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) /* Y NO ARRAY! */ ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<h2 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h2> <h2 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h2>
</hgroup> </hgroup>
<?php else : ?> <?php else : ?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1> <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php endif; ?> <?php endif; ?>
<?php if ( 'post' == $post->post_type ) : ?> <?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta"> <div class="entry-meta">
<?php twentyeleven_posted_on(); ?> <?php twentyeleven_posted_on(); ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
@ -44,8 +44,8 @@
<?php endif; ?> <?php endif; ?>
<footer class="entry-meta"> <footer class="entry-meta">
<?php $show_sep = false; ?> <?php $show_sep = false; // perhaps a implode(' | ', $utilities) could be used instead of this $show_sep business? ?>
<?php if ( 'post' == $post->post_type ) : // Hide category and tag text for pages on Search ?> <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
<?php <?php
/* translators: used between list items, there is a space after the comma */ /* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) ); $categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
@ -68,7 +68,7 @@
$show_sep = true; ?> $show_sep = true; ?>
</span> </span>
<?php endif; // End if $tags_list ?> <?php endif; // End if $tags_list ?>
<?php endif; // End if 'post' == $post->post_type ?> <?php endif; // End if 'post' == get_post_type() ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>
<?php if ( $show_sep ) : ?> <?php if ( $show_sep ) : ?>

View File

@ -14,18 +14,13 @@
* *
* @since Twenty Eleven 1.0 * @since Twenty Eleven 1.0
* *
* @param string $hook_suffix The action passes the current page to the function. We don't
* do anything if we're not on our theme options page.
*/ */
function twentyeleven_admin_enqueue_scripts( $hook_suffix ) { function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
if ( $hook_suffix != 'appearance_page_theme_options' )
return;
wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' ); wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' ); wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
wp_enqueue_style( 'farbtastic' ); wp_enqueue_style( 'farbtastic' );
} }
add_action( 'admin_enqueue_scripts', 'twentyeleven_admin_enqueue_scripts' ); add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' );
/** /**
* Register the form setting for our twentyeleven_options array. * Register the form setting for our twentyeleven_options array.

View File

@ -12,7 +12,7 @@ get_header(); ?>
<div id="primary"> <div id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>
<nav id="nav-single"> <nav id="nav-single">
<h1 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h1> <h1 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h1>