Get the latest sticky posts in WordPress

Categories: Wordpress - Tags: , ,

If you want to feature some posts on your WordPress blog, sticky posts is the way to go.

To get the latest sticky posts, find the loop and place this code before your Loop:

$sticky = get_option(‘sticky_posts’);
rsort( $sticky );
$sticky = array_slice( $sticky, 0, 5);
query_posts( array( ‘post__in’ => $sticky, ‘caller_get_posts’ => 1 ) );

mirkohumbert

Comments

No comments yet.

Write a comment

You must be logged in to write a comment.

« »