Showcase template cleanup. See #17748
git-svn-id: http://svn.automattic.com/wordpress/trunk@18269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2571545ec0
commit
b1c7cbf568
|
@ -78,9 +78,9 @@ get_header(); ?>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We're going to add a class to our featured post for featured images
|
* We're going to add a class to our featured post for featured images
|
||||||
* by default it'll have no class though.
|
* by default it'll have the feature-text class.
|
||||||
*/
|
*/
|
||||||
$feature_class = '';
|
$feature_class = 'feature-text';
|
||||||
|
|
||||||
if ( has_post_thumbnail() ) {
|
if ( has_post_thumbnail() ) {
|
||||||
// ... but if it has a featured image let's add some class
|
// ... but if it has a featured image let's add some class
|
||||||
|
@ -94,32 +94,28 @@ get_header(); ?>
|
||||||
// If bigger, let's add a BIGGER class. It's EXTRA classy now.
|
// If bigger, let's add a BIGGER class. It's EXTRA classy now.
|
||||||
$feature_class = 'feature-image large';
|
$feature_class = 'feature-image large';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$feature_class = 'feature-text';
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if ( has_post_thumbnail() ) : ?>
|
|
||||||
<section class="featured-post <?php echo $feature_class; ?>" id="featured-post-<?php echo $counter_slider; ?>">
|
|
||||||
<?php else : ?>
|
|
||||||
<section class="featured-post" id="featured-post-<?php echo $counter_slider; ?>">
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* If the thumbnail is as big as the header image
|
|
||||||
* make it a large featured post, otherwise render it small
|
|
||||||
*/
|
|
||||||
if ( has_post_thumbnail() ) {
|
|
||||||
if ( $image[1] >= HEADER_IMAGE_WIDTH ) { ?>
|
|
||||||
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"> <?php the_post_thumbnail( 'large-feature' ); ?></a>
|
|
||||||
<?php } else { ?>
|
|
||||||
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'small-feature' ); ?></a>
|
|
||||||
<?php }
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<?php get_template_part( 'content', 'featured' ); ?>
|
|
||||||
</section>
|
<section class="featured-post <?php echo $feature_class; ?>" id="featured-post-<?php echo $counter_slider; ?>">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* If the thumbnail is as big as the header image
|
||||||
|
* make it a large featured post, otherwise render it small
|
||||||
|
*/
|
||||||
|
if ( has_post_thumbnail() ) {
|
||||||
|
if ( $image[1] >= HEADER_IMAGE_WIDTH )
|
||||||
|
$thumbnail_size = 'large-feature';
|
||||||
|
else
|
||||||
|
$thumbnail_size = 'small-feature';
|
||||||
|
?>
|
||||||
|
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( $thumbnail_size ); ?></a>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php get_template_part( 'content', 'featured' ); ?>
|
||||||
|
</section>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -129,11 +125,6 @@ get_header(); ?>
|
||||||
<nav class="feature-slider">
|
<nav class="feature-slider">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* We need to query the same set of posts again
|
|
||||||
* to populate the navigation dots
|
|
||||||
*/
|
|
||||||
$featured->query( $featured_args );
|
|
||||||
|
|
||||||
// Reset the counter so that we end up with matching elements
|
// Reset the counter so that we end up with matching elements
|
||||||
$counter_slider = 0;
|
$counter_slider = 0;
|
||||||
|
@ -144,12 +135,12 @@ get_header(); ?>
|
||||||
// Let's roll again.
|
// Let's roll again.
|
||||||
while ( $featured->have_posts() ) : $featured->the_post();
|
while ( $featured->have_posts() ) : $featured->the_post();
|
||||||
$counter_slider++;
|
$counter_slider++;
|
||||||
?>
|
if ( 1 == $counter_slider )
|
||||||
<li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php printf( esc_attr__( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" <?php
|
$class = 'class="active"';
|
||||||
if ( 1 == $counter_slider ) :
|
else
|
||||||
echo 'class="active"';
|
$class = '';
|
||||||
endif;
|
?>
|
||||||
?>></a></li>
|
<li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php printf( esc_attr__( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" <?php echo $class; ?>></a></li>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -177,33 +168,40 @@ get_header(); ?>
|
||||||
),
|
),
|
||||||
'no_found_rows' => true,
|
'no_found_rows' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Our new query for the Recent Posts section.
|
// Our new query for the Recent Posts section.
|
||||||
$recent = new WP_Query( $recent_args );
|
$recent = new WP_Query( $recent_args );
|
||||||
$counter = 0;
|
|
||||||
|
|
||||||
while ( $recent->have_posts() ) : $recent->the_post();
|
// The first Recent post is displayed normally
|
||||||
|
if ( $recent->have_posts() ) : $recent->the_post();
|
||||||
|
|
||||||
// Set $more to 0 in order to only get the first part of the post.
|
// Set $more to 0 in order to only get the first part of the post.
|
||||||
global $more;
|
global $more;
|
||||||
$more = 0;
|
$more = 0;
|
||||||
$counter++;
|
|
||||||
|
|
||||||
if ( 1 == $counter ) :
|
get_template_part( 'content', get_post_format() );
|
||||||
get_template_part( 'content', get_post_format() );
|
|
||||||
echo '<ol class="other-recent-posts">';
|
|
||||||
|
|
||||||
else : ?>
|
echo '<ol class="other-recent-posts">';
|
||||||
<li 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>
|
|
||||||
<span class="comments-link">
|
|
||||||
<?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?>
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php endif;
|
endif;
|
||||||
|
|
||||||
|
// For all other recent posts, just display the title and comment status.
|
||||||
|
while ( $recent->have_posts() ) : $recent->the_post(); ?>
|
||||||
|
|
||||||
|
<li 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>
|
||||||
|
<span class="comments-link">
|
||||||
|
<?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php
|
||||||
endwhile;
|
endwhile;
|
||||||
?>
|
|
||||||
|
|
||||||
</ol>
|
// If we had some posts, close the <ol>
|
||||||
|
if ( $recent->post_count > 0 )
|
||||||
|
echo '</ol>';
|
||||||
|
?>
|
||||||
</section><!-- .recent-posts -->
|
</section><!-- .recent-posts -->
|
||||||
|
|
||||||
<div class="widget-area" role="complementary">
|
<div class="widget-area" role="complementary">
|
||||||
|
|
Loading…
Reference in New Issue