Return to Snippet

Revision: 19660
at October 28, 2009 05:20 by gd6d


Initial Code
<?php
	/* Get all sticky posts */
	$sticky = get_option( 'sticky_posts' );

	/* Sort the stickies with the newest ones at the top */
	rsort( $sticky );

	/* Get the 2 newest stickies (change 2 for a different number) */
	$sticky = array_slice( $sticky, 0, 2 );

	/* Query sticky posts */
	query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );
?>

Initial URL
http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress

Initial Description

                                

Initial Title
Get the latest sticky posts in WordPress

Initial Tags
wordpress

Initial Language
PHP