sticky check 2
This commit is contained in:
parent
027df57a2b
commit
aa3d6e0e53
27
sticky.php
27
sticky.php
|
@ -3,29 +3,18 @@
|
|||
<div class="container">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
// Get IDs of sticky posts
|
||||
$sticky = get_option( 'sticky_posts' );
|
||||
// First loop to display only the single, most recent sticky post
|
||||
$most_recent_sticky_post = new WP_Query(array(
|
||||
// Only sticky posts
|
||||
$args = array(
|
||||
'posts_per_page' => 1,
|
||||
'post__in' => $sticky,
|
||||
// Treat them as sticky posts
|
||||
'ignore_sticky_posts' => 1,
|
||||
// Order by ID
|
||||
'orderby' => ID,
|
||||
// Get only the most recent
|
||||
'posts_per_page' => 1
|
||||
));
|
||||
|
||||
while ($most_recent_sticky_post->have_posts()) : $most_recent_sticky_post->the_post(); ?>
|
||||
<?php
|
||||
/* Include the Post-Format-specific template for the content.
|
||||
* If you want to override this in a child theme, then include a file
|
||||
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
|
||||
*/
|
||||
'ignore_sticky_posts' => 1
|
||||
);
|
||||
$query = new WP_Query( $args );
|
||||
if ( isset($sticky[0]) ) {
|
||||
get_template_part( 'content', get_post_format() );
|
||||
}
|
||||
|
||||
?>
|
||||
<?php endwhile; wp_reset_query(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in New Issue