Making WordPress.org


Ignore:
Timestamp:
11/16/2017 05:35:35 PM (7 years ago)
Author:
ocean90
Message:

Main: Use wp_reset_postdata() to reset post data.

Also limit featured post to published post and skip counting the total rows found.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/front-page.php

    r6098 r6134  
    110110
    111111                <?php
    112                 $featured = new \WP_Query( [ 'posts_per_page' => 1, 'ignore_sticky_posts' => true ] );
     112                $featured = new \WP_Query( [
     113                    'posts_per_page'      => 1,
     114                    'post_status'         => 'publish',
     115                    'ignore_sticky_posts' => true,
     116                    'no_found_rows'       => true,
     117                ] );
    113118                while ( $featured->have_posts() ) :
    114119                    $featured->the_post();
     
    116121                    echo apply_filters( 'the_excerpt', get_the_excerpt() );
    117122                endwhile;
    118                 wp_reset_query();
     123                wp_reset_postdata();
    119124                ?>
    120125            </div>
Note: See TracChangeset for help on using the changeset viewer.