Latest blog posts

Automatically Restart PHP-FPM During Deployments

At work we’ve been rolling out PHP-FPM to more and more of our clients’ servers, which has been great for performance and keeping server loads down. The only issue we’ve had (beyond some initial configuration) was related to our deployments: many of our projects, especially our web applications, are deployed through Capistrano, a Ruby-based task runner that’s extremely popular among the Ruby on Rails crowd. While Capistrano let’s us reduce deployments to running cap production deploy, PHP-FPM typically needs to be restarted before it will start using the new code.

Having to manually SSH into a server to restart PHP-FPM after a deployment takes some of the sexy out of one-line deployments, so we sought to find a better way. The goal: be able to restart PHP-FPM (sudo service php5-fpm restart) from within a Capistrano task without being prompted for passwords (we use Public-Key authentication) or having to manually SSH in to restart the server.

Laravel Application Environments without Hostnames

Forgive me if this is old news, but hostname-based environment switching isn’t as nice as it could be; I like using *.dev for my development environments, but other people I know like  *.development, *.local, etc. The truth of it is the more developers you have working on a project the higher chance you run of the application being run at a variety of hostnames, mucking up your bootstrap/start.php file.

Fortunately, Laravel doesn’t force us into using hostname-based environment switching. At work we’ve developed this little workflow, and it seems to be working really well.

Automatically Set a Poster Image for WordPress Video Embeds

I’m working on a client project right now that makes heavy use of embedded videos. It’s exciting because as someone who primarily develops themes and plugins for marketing sites (and whose personal blog is almost exclusively text and code) it’s rare that I really spend much time with the rich-media embeds that have been getting so much attention from the core team over the last few releases.

As I started playing with the video embeds I immediately noticed an issue – there was nothing in the media widget that allowed authors to set a poster frame (the static image that appears in the video player before the user clicks the play button). I checked the documentation for the [video] shortcode and found that the shortcode does accept an optional poster attribute, which allows authors to specify a poster image.

Growing a Mustache for Men’s Health

This November I’ll be participating in Movember with my co-workers at Buckeye Interactive. Movember is a 30-day event where men grow mustaches in order to raise awareness of and money for men’s health issues, namely prostate and testicular cancers – you can think of it kind of like a 5k cancer run but on men’s upper-lips.

Quick Tip: Restrict a WooCommerce Shipping Method to the Contigious United States

Right now at work I’m working on moving a site from WP eCommerce to WooCommerce and encountered an interesting request: the site offers free shipping but only to the lower 48 United States. That means no free shipping for Alaska, Hawaii, Puerto Rico, etc.

Out of the box WooCommerce supports country-based filtering (e.g. allow free shipping to the United States but not Canada) but to get into more specific restrictions you’d have to start messing with shipping tables or buying the Advanced Shipping Rates plugin which, although I’ve heard good things, will set you back $200.

Fortunately I was able to put together a code snippet that will remove a shipping method (in this case, free shipping) for restricted states. It consists of two parts: a class that extends the WooCommerce core shipping class (WC_Shipping_Free_Shipping for this example) and a filter that tells WooCommerce to use our class rather than the core shipping class it extends.

New speaking section

A bit late considering I gave two talks in the last week but I’ve added a “Speaking Engagements” section to the site. I’m relatively new to professional speaking but am looking for more opportunities to share what I’ve learned. If you’re interested in having me speak at your event, please get in touch!

Speaking at the Columbus WordPress Meetup

For those of you in the Columbus, OH area I’ll be presenting at this month’s Columbus WordPress Meetup on June 18, 2013 (a.k.a. tomorrow). The presentation is based on my latest blog post, WordPress Security Basics, and should be a good high-level introduction to WordPress security.

WordPress Security Basics

Each year thousands of websites are hacked. Sometimes it’s by way of a crafty social engineer (someone who tricks someone into giving up information without realizing it) conning some unsuspecting user out of his/her login. Other times it’s a backdoor in some code that grants a malcontent access to a site.

If your site is running on WordPress you can rest easy – WordPress core is considered to be a very secure application. The downside to WordPress core being secure is that if someone breaks into your site you likely have nobody but yourself to blame. Never fear: these tips will help keep your site safe and sound.

National Day of Civic Hacking at the White House

This past weekend I was invited to attend the second-ever hackathon at the White House as part of the National Day of Civic Hacking. The goal of the hackathon was to build cool applications and visualizations around the recently-released We The People API. As a result I built and released the We The People WordPress plugin, which enables WordPress users to easily embed petitions from We The People using shortcodes and widgets.

You can read all about my day at the White House on the Buckeye Interactive blog. The plugin source and my presentation from the hackathon are both available on Github.

Speaking at WordCamp Columbus 2013

For those of you in or around Central Ohio August 2-3 I’ll be presenting a talk based on “Keeping WordPress Under [Version] Control” at WordCamp Columbus 2013 in the Ohio Union at The Ohio State University. There’s a great line-up of speakers including Pippin Williamson (Pippin’s Plugins) and Samuel “Otto” Wood (if you’ve been developing with WordPress for any amount of time you’ve almost certainly read his blog).

The conference is trying something new this year and dedicating the entire first day (Friday, August 2) to a day-long WordPress beginners’ course with the second day (Saturday, August 3) focused more on WordPress awesomeness. If you work for a company that uses WordPress (as a client or as a vendor) now’s the time to beg your boss to send a group of WordPress newbies to WordCamp – learn how to use the world’s most popular content management system and get out of the office on a Friday in August? That’s one helluva deal for just $40!