From aa3d6e0e53f6b61a32f3400f3d203199c1cb528e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Ko=CC=88nemann?= Date: Wed, 12 Aug 2015 13:06:37 +0200 Subject: [PATCH] sticky check 2 --- sticky.php | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/sticky.php b/sticky.php index b02acee..b5dea0e 100644 --- a/sticky.php +++ b/sticky.php @@ -3,29 +3,18 @@
$sticky, - // Treat them as sticky posts - 'ignore_sticky_posts' => 1, - // Order by ID - 'orderby' => ID, - // Get only the most recent - 'posts_per_page' => 1 - )); + $sticky = get_option( 'sticky_posts' ); + $args = array( + 'posts_per_page' => 1, + 'post__in' => $sticky, + 'ignore_sticky_posts' => 1 + ); + $query = new WP_Query( $args ); + if ( isset($sticky[0]) ) { + get_template_part( 'content', get_post_format() ); + } - while ($most_recent_sticky_post->have_posts()) : $most_recent_sticky_post->the_post(); ?> - - + ?>