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,16 +94,10 @@ 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; ?>">
|
<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
|
<?php
|
||||||
/**
|
/**
|
||||||
|
@ -111,11 +105,13 @@ get_header(); ?>
|
||||||
* make it a large featured post, otherwise render it small
|
* make it a large featured post, otherwise render it small
|
||||||
*/
|
*/
|
||||||
if ( has_post_thumbnail() ) {
|
if ( has_post_thumbnail() ) {
|
||||||
if ( $image[1] >= HEADER_IMAGE_WIDTH ) { ?>
|
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>
|
$thumbnail_size = 'large-feature';
|
||||||
<?php } else { ?>
|
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>
|
$thumbnail_size = 'small-feature';
|
||||||
<?php }
|
?>
|
||||||
|
<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' ); ?>
|
<?php get_template_part( 'content', 'featured' ); ?>
|
||||||
|
@ -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 )
|
||||||
|
$class = 'class="active"';
|
||||||
|
else
|
||||||
|
$class = '';
|
||||||
?>
|
?>
|
||||||
<li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php printf( esc_attr__( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" <?php
|
<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>
|
||||||
if ( 1 == $counter_slider ) :
|
|
||||||
echo 'class="active"';
|
|
||||||
endif;
|
|
||||||
?>></a></li>
|
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -177,21 +168,26 @@ 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">';
|
echo '<ol class="other-recent-posts">';
|
||||||
|
|
||||||
else : ?>
|
endif;
|
||||||
|
|
||||||
|
// For all other recent posts, just display the title and comment status.
|
||||||
|
while ( $recent->have_posts() ) : $recent->the_post(); ?>
|
||||||
|
|
||||||
<li class="entry-title">
|
<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>
|
<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">
|
<span class="comments-link">
|
||||||
|
@ -199,11 +195,13 @@ get_header(); ?>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php endif;
|
<?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