Make WordPress Core


Ignore:
Timestamp:
05/09/2011 10:54:55 PM (12 years ago)
Author:
lancewillett
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/showcase.php

    r17790 r17846  
    4343                    $sticky = get_option( 'sticky_posts' );
    4444                    $featured_args = array(
     45                        'post__in' => $sticky,
     46                        'post_status' => 'published',
    4547                        'posts_per_page' => 10,
    46                         'post__in' => $sticky,
    4748                    );
    4849
     
    5051                    $featured = new WP_Query();
    5152                    $featured->query( $featured_args );
     53
     54                    // Proceed only if sticky posts exist.
     55                    if ( 0 < $featured->post_count ) :
    5256
    5357                    /**
     
    113117                <?php endwhile; ?>
    114118
     119                <?php
     120                    // Show slider only if we have more than one featured post.
     121                    if ( 1 < $featured->post_count ) :
     122                ?>
    115123                <nav class="feature-slider">
    116124                    <ul>
     
    140148                    </ul>
    141149                </nav>
    142                 </div>
     150                <?php endif; // End check for more than one sticky post. ?>
     151                </div><!-- .featured-posts -->
     152                <?php endif; // End check for sticky posts. ?>
    143153
    144154                <section class="recent-posts">
     
    188198
    189199                    </ol>
    190                 </section>
     200                </section><!-- .recent-posts -->
    191201
    192202                <div class="widget-area" role="complementary">
Note: See TracChangeset for help on using the changeset viewer.