We all started somewhere, right?

Standard

This is a humbling experience.

I was inspired to compile these because of @justintadlock‘s tweet.

I went back to oswd.org, the birthplace of my HTML debut. I built all my websites from 2002ish to 2006 in Flash (which sounds like a REALLY long time now). My introduction to HTML and CSS coincided with open source web design very nicely. Unfortunate for the Internet, though, I released seven simple HTML/CSS designs in 2006. Soon thereafter I found WordPress.

Five years later I hope I’m doing better.

Also … ugh … they’ve been downloaded a combined 79,644 times.

1

2

3

4

5

6

7

Theme revisions and WordPress cache busting

Standard

When you enqueue CSS or JS files WordPress will append the current WordPress version as a parameter … an attempt at cache busting.

The process by which sites or servers serve content or HTML in such a manner as to minimize or prevent browsers or proxies from serving content from their cache. This forces the user or proxy to fetch a fresh copy for each request. Among other reasons, cache busting is used to provide a more accurate count of the number of requests from users.
- IAB

This type of parameter on your static resources is semi-useful. When you upgrade your version of WordPress returning visitors will be served with a fresh copy of your files. But what about all those changes you made to your style.css in between WordPress upgrades?

I use Beanstalk as my SVN repository host. Their coolest feature is automated and manual deployments. Simply commit your changes locally and watch them deploy to your staging/production server within seconds. No FTPing (and no accidents). Beanstalk puts a single file in the root directory of wherever you’re deploying to called .revision. It contains a single integer which is the latest revision that was deployed. You could manually update a file like this if you don’t use deployments.

So this function below grabs that revision number. You can then place this function in your enqueue call to replace the default WordPress version parameter with the latest SVN revision number … busting caches when they need to be.

WordPress network in multiple environments with a single database

Standard

Problem

I needed a way in my multisite setup to have multiple environments that shared the same database, but used different domains.

  • server1.example.com
  • server2.example.com
  • example.com

… each of those would point to the same database. This is easy to achieve in a standard WordPress install using define( 'WP_HOME', 'http://server1.example.com' ); and define( 'WP_SITEURL', 'http://server1.example.com' );.

When you add multisite to the mix it breaks.

The problem is that the wp_blogs table defines the domains too, so I needed a way to define them in the config file.

Solution

UPDATE: A more complete solution: https://github.com/developdaly/WordPress-Skeleton

Taking @chrisguitarguy‘s advice, I used sunrise.php to intercept the host and spoof it so that WordPress uses domain I customize to load the site content.

Revisiting my development environment

Standard

Below is a graphical representation of what I’m proposing as a new development process/environment for my larger WordPress sites. I want your feedback.

This doesn’t include all the details. For instance, WordPress configuration files have to be customized for each server, database usernames should be specific to each environment, etc. But should this flow work?

WordPress Development Process

My OS X Frustrations

Standard

Three months ago I started using a Macbook Pro for work. I really love a lot of things about the hardware and the software, but being a Windows user in my previous life there have been a few things to get used to and some things I think are just really dumb.

No merge?!

Ironically, my biggest frustration began when I was actually trying to make backups of a ton of work I had completed over a three week period. Too bad OS X failed me at this point…

In Windows and most Linux distributions, copying a folder onto another folder results in a prompt to merge the contents of the folder, subsequently asking if you want to overwrite/replace existing files. That’s exactly what I wanted and expected. To my surprise, OS X replaces … i.e. DELETES everything in the folder being pasted to. Those files aren’t sent to the trash. There is no undo. They’re gone. End of story. Pissed.

Side note: maybe someone out there has a workaround for this (other than Terminal) If you’ve got a local WordPress installation that has versioned (SVN or Git) files then you can’t use the WordPress automatic upgrade. But it’s worse than that. You can’t just download a plugin and paste the new directory on top of the old plugin because you wipe out all the .svn directories, breaking everything.

Docking

I’m fortunate to have a nice Apple Cinema display with a Thunderbolt connector to simply dock my laptop. You’d think that having a pure Apple setup (laptop, display, connector, keyboard, mouse), everything native and setup as Apple would like you to have that everything would work seamlessly.

Instead, a third of the time I plug my laptop in and my mouse and keyboard don’t work and the only way to operate the setup is from the laptop itself. The only fix is to restart.

Headphones should be simple

This one baffles me because of how simple it should be. When I plug my headphones into the laptop and music is already playing through my monitor sometimes it doesn’t transfer to the headphones. Sometimes it does — no rhyme or reason. Unplug, plug, unplug, plug.

Windows isn’t perfect either…

Windows may not be as simple for people to use, but so far my experience is that OS X has more flaws. That surprises me, because the hardware and software are so controlled. Windows has the vulnerability of hundreds of OEMs, hardware stacks, many more third-party applications, drivers, and more. Despite all that, I have a less buggy and more expected experience on Windows.

The jury is still out though. I’m more easily frustrated because it’s new; the flaws are new to me. There may be just as many or more problems with Windows that I’ve just become accustomed to. After a few months I may follow up with a more experienced opinion.