Skip to content

Instantly share code, notes, and snippets.

@mustafauysal
Last active December 21, 2015 22:48
Show Gist options
  • Select an option

  • Save mustafauysal/6377547 to your computer and use it in GitHub Desktop.

Select an option

Save mustafauysal/6377547 to your computer and use it in GitHub Desktop.
Get latest sticky posts in loop.
<?php
$sticky = get_option( 'sticky_posts' );
$args = array(
'posts_per_page' => 1,
'post__in' => $sticky,
'ignore_sticky_posts' => 1
);
query_posts( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
// loop code
endwhile;
endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment