WordPress Hack: After the First Post only on the Home Page

You’ll note on after the first page after the first post on my home page that I’ve added a Blaugh cartoon. I had one heck of a time figuring out how to simply show the cartoon in one single place on the site without pushing it into the sidebar where it didn’t belong. So… I did some digging and found a couple of themes that utilize some code to do just this. The code could be used to highlight or indicate your latest post… or simply add some content within the WordPress loop.

Here’s how you can do it:

>?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>

Your Content that you want here!
>?php } ?>

For the Blaugh cartoon:

>?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>

>center>>script language=”Javascript” type=”text/javascript” src=”http://blaugh.com/latest.php?s=400″>>/script>>/center>

>?php } ?>

There you go! Just make sure that you put this content within the loop. I put it right before this line, so I can keep track of it:

>?php endwhile; else: ?>