Solution for query_posts() Breaking Things & Causing Havoc

According to my experience and WordPress support forum entries like , the very powerful and useful WordPress function query_posts() breaks several other features like search, next post/previous post, and maybe more. Ugh.

A client wanted their blog post page to show entries only from the current calendar week starting on Monday. So if it was Thursday, the index page would show posts from the last four days, Monday-Thursday. If there ever was a mission for query_posts(), this was it.

$weekstart = date("W");

(Put that above The Loop. It uses PHP’s date() function to get the current calendar week’s first day, which by definition and luck happens to be Monday.)

Fine, but hold on: search broke. A search would return nothing. Who was the culprit? Why it’s query_posts(). I was shocked, shocked (sarcasm).

Here’s how I got around it: I figured if I could make search use another template, one without the offending function, I’d be fine. I looked into that but didn’t find much (didn’t spend too much time looking though). Then I had a better idea: don’t move search, move the index page.

  1. create a new template with your troublemaking query_posts() on it, name it Home
  2. create a new page, give it the Home template
  3. in Admin -> Settings -> Reading set Front Page Displays Static Page -> Home
  4. return the template file index.php to its original state, or at least take off query_posts()

That’s it. Search works because it’s not using the offending template. Home works becuase I get to keep query_posts() on it to display the week’s posts like the client wants. Everybody’s happy.

Tags: , ,

Open Letter to Music Industry PR

Because of my two music sites RMMB and NWMB, I get a daily a ton of emails from music industry public relations people. The emails come from everybody — from the bigtime Atlantic Records to part-timers at Seattle’s tiny Light In The Attic Records.

When I get a PR from someone and it says the magic words “here is a song you can share with your readers” BING I’m 1000X more likely to put that on my music sites. Why? Because I can embed the song in the blog post. One click and you’re listening to the song.

It’s the first/only thing I scan for in PR emails. It offers so much more than the tired MySpace page link that takes someone off my site.

Sorry if that comes off that I can’t stand MySpace (I can’t) and think it’s tailored to 8-year-olds (I do).

What I’m trying to get accross is this: give me content, not links. If you’re writing press spam, think about what you’re writing. Keep it short and simple and give your audience what they want. Send a personal email every now and then, and start it with the recipient’s first name. Easy, thoughtful. You’d be amazed at what a simple REAL email means in a sea of mindless press email blasts.

Tags: ,

What Ad Sizes Should I Accept from Advertisers?

Any you want. My advice, however, is to stick to standard sizes because when advertisers come to you, often they’ll already have a standard size ready to go. That means you can just start running the ad and not worry about having a graphic artist/web dev squeeze stuff into your non-standard sizes, then have that approved by both parties. This has happened to me, and it’s a drag.

When potential advertisers say “what sizes can I run on your site?” I say “any of the industry-standard sizes Google themselves run.”