Code Explosion – Week 6


Happy New Year! I hope you had a wonderful holiday and got some major work done. I realize I have been negligent with the “Weekly” portion of this blog series, and one of my New Year’s Resolutions was to remedy that. So here it is, WEEKLY CODE EXPLOSION – WEEK 6…FOOM PACCKKOWWWW PCKKRRREEWWW [explosion noises].


For a site I’ve been working on, I needed to load query_posts for a specific date range. After digging around, I found this piece of neatness in the WordPress forums. The link for the full thread is here.

  function filter_where($where = '') {
    //posts in the last 30 days
    //$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
    //posts  30 to 60 days old
    //$where .= " AND post_date >= '" . date('Y-m-d', strtotime('-60 days')) . "'" . " AND post_date <= '" . date('Y-m-d', strtotime('-30 days')) . "'";
    //posts for March 1 to March 15, 2009
    $where .= " AND post_date >= '2009-03-01' AND post_date <= '2009-03-15'";
    return $where;
add_filter('posts_where', 'filter_where');

Contact Form 7

A week ago, a client needed to redirect to a thank you page after form submission. I’d been using the super simple Contact Form 7 to handle the form work, but there wasn’t a direct checkbox to make this happen. A few google searches later I came across this code on the Contact Form 7 main site.

on_sent_ok: "location = '';"

Add the above code to the ‘Additional Settings’ box at the bottom of your Contact Form 7 editor and accepted form submissions will redirect the user to whatever page you want.


With one of the agencies I’ve been working for, I launched a site yesterday. I was using a very specific font-face that had tested well and had proved no issue at any point in the testing phase. Much to my, and my boss’s dismay, Firefox rendered our @font-face as Comic Sans. [Insert favorite Comic Sans statement here] After doing a bit of research, we found out it was undoubtedly a server issue, an issue that was confirmed when I came across this article from CSSBakery.

After plugging int he following code to my .htaccess file, Firefox rendered my font correctly and got my blood pressure back down to normal. If you encounter the problem I described, just open up your .htaccess file and drop the following code in.

AddType application/ .eot
AddType font/ttf .ttf
AddType font/otf .otf
<FilesMatch ".(ttf|otf|eot)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"

WordPress Plugins

If you haven’t checked it out yet, go right away to Max Foundry released this awesome CSS3 button WordPress plugin this past week and copies have been flying out like crazy. I helped create several of the button packs so go support Max Foundry and myself by getting the plugin. There is much greatness to behold in Max Buttons Pro.

Link Roundup

These are some of the top links I added to my Delicious bookmarks.

  1. @font-face Gotchas – Paul Irish
  2. TableSorter – jQuery Plugin
  3. 40+ Must-Have Cheat Sheets For Web Designers
Notify of
Inline Feedbacks
View all comments

John Hartley is a Director of Product Engineering at Beam Dental in Columbus, OH. With 5+ years of leadership experience he has worked in startups, agencies, and began his career as a freelance Front End Developer. Always looking to iterate, this blog is a place for him to share his knowledge as well as hone his craft, challenge assumptions, and build a strong base of leadership and management knowledge. Connect with him on LinkedIn

Would love your thoughts, please comment.x