Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 112756

alchymyth on "Format post if it's the second most recent."

$
0
0

untested - general idea:

<?php $cat_ref_posts = get_posts(array('category_name' => 'news', 'posts_per_page' => 4));
if( $post->ID == $cat_ref_posts[1]->ID ) { ?>
 include (ad1.jpg)
<?php } elseif( $post->ID == $cat_ref_posts[2]->ID ) { ?>
 include (ad2.jpg)
<?php } elseif( $post->ID == $cat_ref_posts[3]->ID ) { ?>
 include (ad3.jpg)
<?php } ?>

http://codex.wordpress.org/Template_Tags/get_posts


Viewing all articles
Browse latest Browse all 112756