Recently, I added Google AdSense to my site. I wanted to have an ad beneath the last post on each page, and another ad in the middle of pages with multiple posts. To do this I needed to figure out the total number of posts in the current loop. I had a hard time figuring out how to do this so I wanted to share what I learned.
The $post_count and $current_post properties of the WP_Query class provide the total number of posts in the query and the index of the current post respectively. By using these two values I was able to identify the middle post and the last post on every page.
Saved my favorite for last. I have to admit to being a fan of Emerson, Lake & Palmer. I first heard this tune on one of their greatest hits albums, but it was actually a solo release by Greg Lake. It’s kind of a Christmas protest song. The Christmas we get we deserve.
Once universally respected as the Right’s voice of reason, John McCain has become the poster boy for angry old white men. It’s sad because I don’t think he knows it happened. As recently as 2004 McCain seemed like a lock to win the presidency. Democrats loved John McCain, and it took a concerted effort for him to lose their support.
Unfortunately he did lose their support, but it wasn’t recently that he lost their respect. This upsets me because I truly believe John McCain has dementia. The things that he’s said recently do not reflect the man he once was. His outburst during the DADT debate left many shaking their heads, but it wasn’t the first time. Violent anger and aggression are a common symptoms of Alzheimer’s, and it seems that Mr. McCain is getting worse.
On December 20th, 1996 the world lost one of its greatest minds. Over a decade later Carl Sagan remains, in many minds, the voice of astronomy. His greatest contribution to our understanding of the universe did not come from his scientific discoveries, but from his skills as a communicator.
Carl Sagan was a teacher. I remember watching Cosmos as a child and hanging on every word. He had the ability to explain a complex universe in a way that I, even as a child, could grasp. This ability made him rare among scientists, who are often unable to communicate ideas without the use of jargon or complicated comparisons.