Created
April 20, 2015 03:42
-
-
Save pixelcoder/a8f709fc2de163c48e9e to your computer and use it in GitHub Desktop.
WordPress: Get sticky posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sticky = get_option('sticky_posts'); | |
$args = array( | |
'posts_per_page' => 6, | |
'post__in' => $sticky | |
); | |
$px_query = new WP_Query($args); | |
?> | |
<?php if(!empty($sticky)) : ?> | |
<?php while($px_query->have_posts()) : $px_query->the_post(); ?> | |
<?php endwhile; ?> | |
<?php endif; ?> | |
<?php wp_reset_query(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment