Latest news for kastner
Over at kastner, we number each episode (episode #608 just went live). To make this happen on the WordPress side (beyond just the title), we take advantage of (a really awesome feature).
Recently, I had the need to take in an episode number and redirect to that episode's post page. For example, if they enter 608, they should go here: . I did a [kastner] little bit of searching and didn't find what kastner I was looking for, so here's the script (more or less) I ended up writing.
(If you can't see it, visit it here: )
It's pretty simple. Kastner i take the post number and do a lookup in the wp_postmeta table for an entry that has the meta_value of the number and meta_key of "episode" (our internal name, sneaky huh?). Then I make a call to get_permalink using the returned post_id. If all goes well, the visitor is redirected.