Using Scroll Reveal for Animation Effects

I’ve been rebuilding a WordPress site that was originally set up using a popular ThemeForest theme and Visual Composer. The theme made it really easy to add animation effects that occur on scroll (as specific elements come into view), but extracting the code for animations wasn’t super easy (it’s part of a 600kb javascript included by theme and mixed with inline styles from Visual Composer).

However, after testing a few different libraries, I found Scroll Reveal worked best as a replacement (3k minified & gzipped). Continue reading

Themes Shops Might be Dead: Thoughts on an Alternative Business Model

For the past year I’ve been working at Cratejoy, a small venture funded startup in Austin. One of the most interesting aspects of the job has been learning first-hand what it takes to grow a small business into a much larger one. Specifically, I think the business model Cratejoy started with could work really well for many WordPress based businesses and consultancies.

Cratejoy began as an ecommerce website solution for subscription box companies. The business model was a monthly platform fee (~$30/mo) and 1.25% transaction fee on all sales. At the time subscription box businesses like Birchbox, Barkbox, and Naturebox were taking off, but creating a website solution for recurring physical sales was still really difficult. The founders of Cratejoy raised $4 million from investors who were interested in exploring a potential new ecommerce market. Continue reading

How to Set JSON Endpoints in WordPress to Access an External API

There’s a lot of JSON-based APIs that only provide access through server-side methods. If you want to use client side javascript with one of these external APIs, you’ll need to have your server access the data and serve it through ajax requests or your own JSON endpoint. Thankfully, this is really easy to do with WordPress.

In this example project, I’ll show how to get shipping rates from the Easy Post API with a custom WordPress endpoint. Continue reading

Importing Yahoo Mail into Gmail With Original Dates

With Yahoo being sold off in chunks to Verizon, I finally decided it was time to migrate my decade worth of Yahoo email over to Gmail.

Although Gmail offers an easy “Import mail and contacts” link from the “Settings > Accounts and Import” tab, this is not what you want to do (this is what I tried first). All your email will transfer over, but it won’t have the proper sender email address or date. Continue reading

Display Posts or Pages Based on a Navigation Menu

For a site I’ve been working on there’s a section of “featured content” near the bottom of the home page. I was using a simple WP_Query to generate the markup, but after the third time updating the post IDs (because different content needed to be featured), I decided this needed to be managed somehow through the dashboard.

selections

The most common way to do something like this is generally to have a WP_Query that pulls from a specific taxonomy term (like a “featured” tag), however this doesn’t give you any control over the order of the posts. Also, in my case, I needed to display pages and a custom post type “guide” in addition to standard posts.

Thankfully, the WordPress Navigation Menus provide an easy built in interface that can be used to select content. So, I swapped my hardcoded query to pull Post IDs from a navigation menu instead. I thought it would be worth sharing the solution since this could be used in many types of situations: sliders, setting featured products for a specific template, or featuring content in a sidebar or footer. Continue reading

Multiple Domains, Tracking and Third-Party Cookies

Tracking anonymous visitors across multiple domains is difficult because cookies can’t be shared across domains. One way around this is to use an iframe to set the cookie, which works well in Chrome, Firefox, and Edge. However, Safari prevents a challenge because it prevents third-party cookies from being set.

I haven’t found a solution for the Safari issue yet, but thought I’d share the method I’ve worked out for cross domain tracking with Mixpanel for the remaining browsers.

For the example, I’ll use domains a A.com and B.com. A.com is the primary website and B.com is a marketing website that refers traffic to A.com.

On domain A.com you’ll need to set up an URL that loads the tracking code when it’s called inside of an iframe. We can pass tracking data from B.com to the iframe using a query string, and an efficient method for passing that data is by base64 encoding an JSON object. Continue reading

Working with the Mixpanel API

We use Mixpanel at Cratejoy to track a lot of user interactions across the sites. However, there was a lot of profile data we were storing (and paying for) that we weren’t actually doing much with. So, I decided to see if it was possible to back up this data locally, create re-import files (in case we ever needed it again), and then delete in bulk.

Here’s some notes and tips about that process. Continue reading