Twenty Eleven: fix changes in r17846, props nacin - see #17198
* Simplify WP_Query call to pass args directly * Don't use Yoda Conditions for <, >, <=, >= as they can be hard to read (ref: http://codex.wordpress.org/WordPress_Coding_Standards#Yoda_Conditions) * Fix typo in query args git-svn-id: https://develop.svn.wordpress.org/trunk@17847 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9554d20f7a
commit
3bda471af7
@ -43,16 +43,15 @@ get_header(); ?>
|
|||||||
$sticky = get_option( 'sticky_posts' );
|
$sticky = get_option( 'sticky_posts' );
|
||||||
$featured_args = array(
|
$featured_args = array(
|
||||||
'post__in' => $sticky,
|
'post__in' => $sticky,
|
||||||
'post_status' => 'published',
|
'post_status' => 'publish',
|
||||||
'posts_per_page' => 10,
|
'posts_per_page' => 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Featured Posts query.
|
// The Featured Posts query.
|
||||||
$featured = new WP_Query();
|
$featured = new WP_Query( $featured_args );
|
||||||
$featured->query( $featured_args );
|
|
||||||
|
|
||||||
// Proceed only if sticky posts exist.
|
// Proceed only if sticky posts exist.
|
||||||
if ( 0 < $featured->post_count ) :
|
if ( $featured->have_posts() ) :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We will need to count featured posts starting from zero
|
* We will need to count featured posts starting from zero
|
||||||
@ -118,7 +117,7 @@ get_header(); ?>
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Show slider only if we have more than one featured post.
|
// Show slider only if we have more than one featured post.
|
||||||
if ( 1 < $featured->post_count ) :
|
if ( $featured->post_count > 1 ) :
|
||||||
?>
|
?>
|
||||||
<nav class="feature-slider">
|
<nav class="feature-slider">
|
||||||
<ul>
|
<ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user