On my Blog http://flattrendz.com/, I currently want to display the latest sticky post.
I used the code of http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress
<?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 ) );
?>
<!-- BLOG BAR -->
<div class="blog_bar <?php echo $blog_bar_class; ?>">
<div class="container">
<div class="text-center">
<h2 class="lead">
<span><?php printf(__('From Our Blog', 'dot')); ?> </span>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('%s', 'dot'), get_the_title()); ?>"><?php the_title(); ?> <i class="icon-long-arrow-right"></i></a>
</h2>
</div>
</div>
</div>
<!-- // BLOG BAR -->
<?php endwhile;?>
<?php
}
else { }
/* Restore original Post Data */
wp_reset_query();
?>
What I need to do is if there are posts marked as sticky post, then display just the latest sticky post, or else simply display the latest post.