Twenty Eleven: showcase template improvements - see #17198 (props kawauso for patches)
* Only show "featured-posts" area if there are published sticky posts. * If there is only one sticky, hide the slider and just display the single featured post. git-svn-id: http://svn.automattic.com/wordpress/trunk@17846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c5b106de63
commit
aee2fce01f
|
@ -42,14 +42,18 @@ get_header(); ?>
|
||||||
*/
|
*/
|
||||||
$sticky = get_option( 'sticky_posts' );
|
$sticky = get_option( 'sticky_posts' );
|
||||||
$featured_args = array(
|
$featured_args = array(
|
||||||
'posts_per_page' => 10,
|
|
||||||
'post__in' => $sticky,
|
'post__in' => $sticky,
|
||||||
|
'post_status' => 'published',
|
||||||
|
'posts_per_page' => 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Featured Posts query.
|
// The Featured Posts query.
|
||||||
$featured = new WP_Query();
|
$featured = new WP_Query();
|
||||||
$featured->query( $featured_args );
|
$featured->query( $featured_args );
|
||||||
|
|
||||||
|
// Proceed only if sticky posts exist.
|
||||||
|
if ( 0 < $featured->post_count ) :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We will need to count featured posts starting from zero
|
* We will need to count featured posts starting from zero
|
||||||
* to create the slider navigation.
|
* to create the slider navigation.
|
||||||
|
@ -112,6 +116,10 @@ get_header(); ?>
|
||||||
</section>
|
</section>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Show slider only if we have more than one featured post.
|
||||||
|
if ( 1 < $featured->post_count ) :
|
||||||
|
?>
|
||||||
<nav class="feature-slider">
|
<nav class="feature-slider">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
|
@ -139,7 +147,9 @@ get_header(); ?>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
<?php endif; // End check for more than one sticky post. ?>
|
||||||
|
</div><!-- .featured-posts -->
|
||||||
|
<?php endif; // End check for sticky posts. ?>
|
||||||
|
|
||||||
<section class="recent-posts">
|
<section class="recent-posts">
|
||||||
<h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1>
|
<h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1>
|
||||||
|
@ -187,7 +197,7 @@ get_header(); ?>
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section><!-- .recent-posts -->
|
||||||
|
|
||||||
<div class="widget-area" role="complementary">
|
<div class="widget-area" role="complementary">
|
||||||
<?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?>
|
<?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?>
|
||||||
|
|
Loading…
Reference in New Issue