Custom Conversion Tracking in WooCommerce


If you integrate any third-party services with your WooCommerce site (for ads, analytics, marketing, drop shipping, or A/B testing), it’s often helpful or necessary to provide conversion data through javascript.

A lot of the big services, like Google Analytics (tutorial) or Facebook ads, have off-the-shelf extensions you can use. But for smaller services, you often have to write some custom code to send them the conversion information.

Generally the easiest way to do this is by using the woocommerce_thankyou hook. This action is only fired on the order confirmation page and also provides the $order_id variable, which gives access to all the order details. Continue reading

Interview: Elmastudio


Elmastudio is a WordPress theme shop run by Ellen Bauer and Manuel Esposito. Their approach to themes in unique, with interesting layouts and minimalist artful design. Even content for the theme demos has original photography and writing.

We talked a few months ago via Skype, soon after the release of Onigiri and Ponsonby. We discussed the design process, finding inspiration, traveling, and the WordPress community. I was inspired by the creativity and passion they bring to their craft. We talked for a little over an hour, which I edited that down to about 45 minutes of audio. I also wrote up much of the interview for you to read below. Hope you enjoy both!

Continue reading

Efficient Script Loading for oEmbeds


I’ve been using FitVids.js in a lot of recent themes to ensure video displays nicely in responsive layouts. I wrote about this in detail for a previous post.

The FitVids script is super tiny (1.7k), and I generally concat it will all my other scripts and then minify using Grunt. So, it’s really not a lot of additional page weight to include the script. However, I was just clued into an alternate method when doing a theme review for the Make theme on that could be slightly more efficient.

Generally FitVids will only be required if video is loaded via an oEmbed (YouTube, Vimeo). So, if we hook into the oEmbed and already have the FitVids registered to load in wp_footer, we can just enqueue the script when it is needed. Continue reading

Tracking eCommerce in WordPress

If you run any type of eCommerce site, it’s important to understand how visitors found your site and which specific entry pages led to a conversion. Tracking data can also let you know the type of content or marketing that is worth investing in.

Here’s a screenshot from a basic eCommerce dashboard I have set up in Google Analytics for a client with a WooCommerce shop (some data changed to make anonymous):


Seeing the top referrers, landing pages, and revenue at a glance is great. But once the eCommerce data is in Google Analytics, you also drill down and answer very specific questions.

For instance, is an ad campaign on one site performing better than another? Should ad traffic be sent to the home page or the shop page? What is the conversion rate (or total revenue numbers) for visitors from Google who landed on an article page via an organic search? Continue reading

Custom Links in the Customizer


Adding custom links or markup to the theme customizer can be a bit difficult since everything is injected with javascript rather than the normal PHP toolkit. However, there are a number of use scenarios where this might be useful.

One common use case for theme authors might be to add a documentation link or an upsell link so users can find out about theme features.

The approach I like the best is one I first saw employed by the Theme Foundry with their theme “Make”. Their upsell link is prominent, but it doesn’t detract too much from the theme customization experience or take up too much space in the limited UI.


This tutorial takes a similar approach, but shows how to add a styled link to the “Active Theme” section. Continue reading

Concepts for Custom Theme Development


If you’re new to WordPress development, there’s a couple techniques that will be incredibly useful when building themes for a specific company or purpose. Most WordPress themes available are built for general use, but when adapting it for a specific site it’s usually necessary to hardcode at least a few specific elements rather than make everything dynamic.

For example, it might make sense to hardcode the menu if it requires a lot of custom styling. It might make sense to query for specific pieces of known content. Certain pages may have a lot of art direction or targeted styles that would be incredibly difficult to build a custom UI for.

If you’ve already built a few custom themes, it’s likely know a many of these tips already- but hopefully there’s a few gems that will be useful for your toolkit. Continue reading

Theme Repository Data


Aaron Jorbin just released a script called the “WordPress Theme Directory Slurper“, a command line PHP script which downloads the latest stable version of every theme in the theme repository. You can find more information about it in the GitHub repository.

I had a number of questions about the themes on, so I ran the script this morning a slurped all the themes. It took 112 minutes to run and downloaded nearly 4GB of theme code. Here’s what I found out. Continue reading

Version Control and Deploys with WP Engine


It’s taken me a bit of time to figure out the best way to version and deploy sites with WP Engine. I still don’t have a perfect solution, but it’s now much better than using an SFTP GUI to move the files from local to staging.

Version Control

In terms of version control, I like to have the active theme in its own repository. This is generally where the bulk of custom development work happens, and this makes it easy to view the commit history, open issues, and reference code. If custom plugins are needed for the site, I also like to have those in their own repositories for the same reason.

For everything else on the site (WordPress core, third-party plugins, and media) I think it’s important to have backup points (especially before plugin/core upgrade in case a rollback is required), but I don’t necessarily need to have that versioned with something like Git.

If you’re not like me and prefer to have the entire site versioned in one repository, then git deploys work great with WP Engine. You can even set the gitignore file to ignore specific third-party plugins, media, and core so it just tracks your custom plugins and themes- but those all still need to be in one single repository that is tracked from the root of the WordPress directory. Continue reading