Code Snippets: Ad Display Function For Use in A CMS Template

Since I was recently invited to be an publisher, I had the pleasure of trying to find a way to integrate the ads tastefully into my site on the top level pages, as well as in individual posts. The current iteration of my site, as well as the last one, really only rely on the single column of content, so I lack a useful sidebar to place ads in; this pretty much limits me to placing ads in the content–well not quite in the content, but in the flow of content really.

So, I essentially needed ads to run after the first post, and only once on any page. In order to do that I needed a simple function that I could run in the WordPress loop, and guarantee my requirements were met.

Thus, the display_ads function was born:

function display_ads(){
    global $ad_count;
	if($ad_count  1){
      $display = 'AD CODE HERE';
	  echo $display;

It’s quick and dirty but pretty effective. Is there a better way to do this, because this is pretty much the quickest thing I could come up with on short notice? I am legitimately asking you, is there a better way?