MattWalters.net Rebuild: Step 1

I recently relaunched my website using some best practices I’ve learned over recent years. This is the first part of a post series detailing some of the steps I took and why.

The first step of rebuilding my website was to get the structure set up.  I had run WordPress itself off of a checkout from Subversion for a while, but I typically took it a step further on client sites and wanted to do that with my site.  The real trick here is to setting it up in a way that you maximize external repositories, while still being able to support your theme and other supporting materials inside a version control service.  As I mentioned, Subversion supports what are known as “externals.”  These are references to other source code repositories.  They are ones that you support or that another developer maintains and makes publicly available.

The first step is to set up a repository of your own.  I run a subversion server on one of my servers.  But you can also find hosted services that offer repositories such as http://svnrepository.com/.  This will allow you to check out a local working copy and start building your site.  The next step is to do some minor setup in your repository.

WordPress has a Subversion repository which follows the standard practice of tagging versions.  You can think of a tag as a snapshot of code.  Many plugins are also hosted by WordPress.org which offers plugin/theme hosting.  Theme and plugin authors check in their code to a subversion repository and once you know the basic URL structure, anyone can check it out anonymously.  The themes and plugins also typically follow the branch/tag/trunk structure.  However, for your theme, I would not recommend referencing it as an external.  You wouldn’t be able to check your changes into your repository.  It would be better to download it and add it to your repository or to export it into your sites directory structure and add it to your repository.  If you were going to build a child theme off it, referencing it as an external might make sense.  It all depends on what you need to do.

Here are the basic steps I take to set up a site:

  1. Create subversion repository
  2. Check out repository on my local machine
  3. Add branch/tags/trunk folders
  4. Create “database”, “graphics”, “providedItems”, and “src” directories inside the trunk directory
    1. Database stores content/structure dumps of my local development database
    2. Graphics stores design assets from the sites designer or my PSD files created for the site
    3. Provided Items stores things like copy, and other misc items related to the site
    4. Src will be the site root
  5. Move into src directory
  6. Create external reference to WordPress subversion tag for a folder called something like “wp”
    1. You can do it however you would like, but cannot install WordPress in the root.  It’s ok though because you can put an index.php in the site root that will include WordPress and use WordPress’s configuration settings so that the wp directory doesn’t display in your sites URL.
  7. Create content directory, then inside of content, themes, plugins, uploads
    1. This is basically a recreation of the wp-content folder.  You use one outside of the WordPress folder because WordPress is now an external reference, and you can’t check items into WordPress’s repository.  By moving the wp-content directory, you can check in things like your themes/plugins into your repository and still enjoy version control.
  8. Create a folder in /content/themes/ for my theme and add in the theme I will be building from
    1. I have maintained a fork of the Sandbox theme for a while now, but have never made it publicly available, I may do that sometime soon.  But it’s basically a very generic theme that offers lots of CSS classes/ID’s and has some customizations I’ve made to it to make certain things easier (like including page specific JS/CSS, etc).
  9. Back in the site root, create index.php, add a favicon.ico, robots.txt
    1. You should always include a favicon.ico file, even if it is just a blank one.  Browsers automatically request it, and if it does not exist then WordPress still “spins up” to serve a 404 error, increasing server load.  You can also block favicon.ico requests at the .htaccess level if you prefer.
  10. Create a wp-config.php in the site root and do configuration edits, setup database, etc
    1. One of the key edits here will be telling WordPress that you have moved the wp-content folder.  The WordPress Codex has a pretty good write-up on edits you can make to wp-config.php.
  11. Go through install process with WordPress
  12. In the /content/plugins/ directory, I add external references for any plugins I plan to use for the site which point at the latest release tag for that plugin
    1. I have some standard plugins I always include in installs, but you can include any other plugins that you would like.  Some of the default ones I always install are the Google XML SiteMap generator, All In One SEO Pack, and WordPress File Monitor.
  13. Activate plugins in the WordPress admin
  14. Activate theme in the WordPress admin
  15. Perform any default settings in WordPress admin
  16. Export data/structure of database and add to the /trunk/database/ folder
  17. Develop theme

At certain points you might need to commit your changes to Subversion so that you can do an “svn update” and get all the files for the external references you setup, but this post isn’t really meant to be a full Subversion how-to.  Feel free to ask questions if you need to in comments and I’ll try to help out.  In the end you end up with a structure something like this:

  • Repository Root/
    • branches/
    • tags/
    • trunk/
      • database/ – Store database exports here
      • graphics/
      • providedItems/
      • src/
        • content/
          • plugins/
            • Plugin 1 – svn:externals reference
            • Plugin 2 – svn:externals reference
            • Plugin 3 – svn:externals reference
            • <etc>
          • themes/
            • <Your Theme>/
          • uploads/
        • wp/ – svn:externals reference
        • index.php
        • favicon.ico
        • wp-config.php

I think that pretty much covers the setup, but if something doesn’t make sense, feel free to ask questions.  Once you have this structure setup, you’re free to develop your theme and check it into your repository / enjoy source code versioning.  Once you’re ready to launch the site, you can either export your repository and upload it to the server, or if you want to be fancy you can check the repository out on your server and let the site run off it so that if you need to do updates later, all you’ll have to do is log in to the server and run an “svn update” to deploy.

WordPress HelpCenter

Today I start a new gig.  I’ll be teaming up with Alex King (of WordPress fame) to manage the WordPress HelpCenter.  During the past several years I’ve had increasing interest in working with WordPress full-time.  It started with me developing themes and plugins for my own site then branched into customizations for clients and over the past roughly 2 years has nearly grown into full-time work providing WordPress services.  Today it finally becomes my full-time endeavor.

That’s not even the interesting part though.  When I first heard about WordPress HelpCenter, the idea of it alone struck me as something I could believe in.  The basic idea is that you can receive on demand support for your WordPress powered site.  The “on demand” piece is key.  Many of us have been working in a typical client/service provider relationship for years now.  The client puts in a request, we receive it, perform an action, get sign off, deploy.  Depending on the request and the current project load of the service provider this process could take awhile, sometimes days or even weeks.

WordPress HelpCenter is different.  With the HelpCenter there is a phone number that you can dial, 303-395-1346.  Calling that number will put you on the phone with a WordPress expert, ready to help you with your request, whether it’s how to turn off comments for a post, customizing a theme/plugin for your site, or just about any other WordPress related item you can think of.

But wait, there’s more! ;)

WordPress theme and plugin developers can sign up for the Affiliate Program.  Whenever we help a user with a support request concerning your theme or plugin, you can earn cash.  We’ll also help you with bug reports.  If we identify a bug that can be reproduced we’ll send you a detailed bug report along with steps on how to reproduce it so that you can work on a fix for it.  You can also get plugins, badges, links, and more to help direct your users to the HelpCenter that already have your affiliate code in them.  This free’s you of some of the support requests and allows you more time to produce quality code while still knowing that your users are being taken care of.  I’d highly recommend registering your themes and plugins if you haven’t already.

This is obviously something I’m excited about and I look forward to seeing the service grow.

BlackBerry Curve 8330

BlackBerry Curve 8330Roughly 9-10 months ago, I switched from my iPhone to an enV2 with Verizon. AT&T’s coverage was just horrible, basically making my iPhone an iPod Touch with an expensive monthly subscription cost. Anyhow, the enV2 served me well, but I got to where I was needing to keep a closer eye on some things (WordPress Easily, some work stuff, etc) so moving back to a real “Smart Phone” was making sense. Enter the BlackBerry Curve.

I have previously used a BlackBerry. I always remembered the BlackBerry as being a consistent and reliable device, but using the Curve I’m starting to realize just how much I really enjoyed the style of phone. It really is a well thought out device, from push email to the tactile nature of the keyboard, from how stable the platform and applications are to the new store for BlackBerry apps. So far I’m really enjoying the device. I won’t go on and on with a long review, but here are the basics as I see it, in no particular order:

Pro’s:

  • Verizon service. It’s extremely rare that I see No Service. I actually can’t remember the last time a call dropped because of my service or that I was unable to place a call.
  • Keyboard: I’ve said for a long time that this is a key advantage of the BlackBerry over the iPhone. I really like the iPhone as a device, and the keyboard logic on it is superb. But the easiest way to explain it is on the iPhone I constantly had to watch my typing to see if it was going to catch/fix the typos I would surely make. On the BlackBerry, I just don’t make the typos to begin with.
  • Applications: The BlackBerry has REALLY improved in this realm since the last time I used one of the devices. Here is some of what I have installed:
    • GMail (the application version) – This works well for checking my multiple gmail and google apps accounts, though I do wish I could control the update interval, but I really like that it is able to keep conversations grouped, etc.
    • Pandora – Wow … over a cell phone’s internet connection I can’t believe how well this works. Quality enough to make an audiophile happy? Probably not. Quality enough to make me happy? Yes.
    • Google Talk – It’s not often that I need to IM over the BlackBerry, but this is a great real time client for when I do need to.
    • BlackBird Twitter Client – It isn’t going to stun you with its looks, but it has the core functionality I want when I’m using twitter on the go. I’m usually only checking updates on the go when I’m bored, I can quickly skim with Blackbird. It also works well for sending updates and catching @replies even from people I’m not following.
    • Google Maps – Not sure this needs explanation. It’s a great app and works well.

Con’s:

  • Trackpad/Scroll ball: They really should have stayed with the thumb wheel in my opinion. It is tolerable, but I preferred the thumb wheel.
  • Keyboard: Weird this is mentioned in both places right? It’s a little on the small side, but I find it hasn’t been a problem and I’m adapting quickly.
  • Camera: I was a little torn how to rate this. Listing it as a Con may not be appropriate … but it’s a cell phone camera so keep your expectations low.

Overall, I would say my feelings about the device are positive. I’m really liking the new applications that are available and I’m pretty sure I’m addicted to the CrackBerry once again ;) Not to keep comparing it to the iPhone, but that’s really the only device worth trying to compare it to … in my opinion, the BlackBerry is still the Gold Standard to be beat. The iPhone rocks, but they still need to work some things out if the BlackBerry userbase is a target audience (which it may not be and that’s cool, there’s enough room for both products).

WordPress Backups

Backing up your site is something that is very important to do. You never know when you might make a change that you need to revert, or you install a plugin that goes haywire harming your site. A reliable backup routine that is put into practice early and often is always a good idea. I authored a post on backups over at WordPress Easily that I thought folks might find useful even outside of that services’ context, so I’ve decided to convert it here as a more all-purpose backup strategy.

Many web hosts have backup plans in place. However they are usually more focused on protecting the server from a catastrophic failure then they are about being able to restore a backup because a piece of software you installed messed up your account. In general, it’s best to never rely on your web host to have you taken care of where backups are concerned. What if they go out of business? What if they have a catastrophic failure that’s so bad even their backup plan can’t recover from it? What if you just want to change web hosts?

So that leaves the question, what can you do for your WordPress site? Well, there are many tools out there to help with this. The first, and easiest, is using WordPress’s built in XML export of data. This will get all of your posts, pages, comments, custom fields, categories, and tags. If you ever have to restore your site from it, it’s as easy as using the built in XML import. Unfortunately it does potentially leave out some data.

Some plugins store their data in their own database tables, which won’t be included in the XML Export. To get that data backed up, you may want to consider using something like the WP-DB-Backup plugin. It can create a SQL Dump of your entire WordPress database, including table structures and data. If you ever need to restore from that you’ll want to make sure that you have access to a tool like phpMyAdmin with your web host, or the plugin mentioned in the final option below. You’ll need to be able to execute queries directly against your database to restore from it.

A final option, and probably the most advanced, is you can use WP-phpMyAdmin. This gives you a copy of phpMyAdmin within your WordPress administration panel. You can export your database from this (which will create a SQL Dump file just like WP-DB-Backup), then if you ever need to restore, you can use WP-phpMyAdmin to import your database. I wouldn’t recommend WP-phpMyAdmin unless you’re fairly comfortable working with SQL Databases. But if you have a SQL Dump of your WordPress database, chances are whichever host you are using, they’ll have a method to let you restore it.

All of that takes care of your database and most of your content, but what about your themes, documents, plugins, etc? You can use an FTP program to download your site to your local computer. You probably don’t even need to do the entire site. If you download your /wp-content/ directory that should take care of anything you need since that is where your themes and plugins are stored, as well as any files you upload from within the WordPress administration area.

As I said, it’s recommended that you get a backup plan in place early and that you practice it often. You never know when you’ll need that backup. It could be never, or it could be tomorrow.

WordCamp – Richmond, VA

It’s still very much in the preliminary stages, but I’m hoping to host a WordCamp for the area. I won’t rehash everything I wrote in my post over on the official website, but I suggest you read it and then take the survey if you’re interested in attending.

WordPress Filter on Plugin Directory

WordPress Filter is now listed on the WordPress Plugin Directory.  So you’ll be able to get your 1-click upgrade goodness and all that fun stuff.  Just figured it was worth mentioning :)

Announcing: WordPress Filter

I’m happy to annouce WordPress Filter v1.0 (Release Candidate 1).  I decided to make this just RC1 because I would like to have some folks help test it out before I move it securely into v1.0.  What is WordPress Filter you ask? Well, continue reading for the introduction then check out the project page.

Introduction

WordPress Filter is a comprehensive post filtering system. It allows the user to define a set of simple “Catches” to be met by a post, and then have a set of “Actions” applied to the post. This plugin takes action whenever a Post is saved inside of WordPress (including Posts coming in via XMLRPC). It can be used for many tasks, including creating your own mini plugins without ever having to leave your WordPress administration area.

Example Usage

Let’s assume you want to participate in Project 365 but want to make it as easy as possible. You would like to take a picture with your camera phone and send it to your flickr2blog email address with the title “potd”. To do this, you could use WordPress Filter in this way:

Define the Catch:

  • If Post Title: Equals “potd”

Apply the Actions:

  • Title: Replace “Picture of the Day
  • Tag(s): Add “potd_%%year%%, photo
  • Content: Append “<br/><br/>This photo is part of my Picture of the Day Series for %%year%%.

It’s fairly self explanatory, but when the post arrives at your blog: it would add the tags “potd_2008, photo”, add a short bit of text to the end of the content, and change the post title to “Picture of the Day”.

%%year%% is a substitution that will be made by WordPress Filter at the time the post is saved. It inserts the current four digit year. There are other SystemSubstitutions as well.

[Continue reading on the project page]

Backup Strategy

Over the past weeks/months I’ve become more interested in making sure my systems are properly backed up.  Recently I mentioned I wanted to detail my setup in a post.  It’s been awhile since I’ve suffered a significant hardware failure (knock on wood) so part of me thinks I’m “due” for one.  Here is my basic process and my current setup:

Setup:

  • 2008 MacBook (Main System) – 320GB internal drive
  • First Gen black MacBook (Media Center / File Server) 80GB internal drive
  • 3×250GB external HDD
  • 2GB, 4GB, 8GB thumb drives (these particular ones are tiny)
  • Account with BingoDisk (100GB Plan)
  • Amazon S3 Account
  • MobileMe Account

Process:

  1. My main system has a TimeMachine (250GB external USB) drive connected to it almost constantly.  It’s certainly connected when I’m working, and is usually only not connected when I retire to the sofa to watch TV or go to a friends house and am just goofing off on it.  I travel with the external drive.
  2. Periodically (I try to do this at least once per week) I use SuperDuper! to clone my main system to a second drive (250GB external USB) which is also carried with me when I travel.
  3. Less periodically then in Step 2 I do a SuperDuper! clone to the third drive (250GB external USB).  This so that if my typical HDD clone is for some reason bad, I can step further back in time in hopes that it will be ok.  This drive does not travel with me.
  4. OSX Install Disk has been cloned to a 8GB thumb drive and travels with me.
  5. I haven’t received it yet, but I ordered Disk Warrior 4 which I also plan to clone to a thumb drive, and it will travel with me.
  6. My main system has a copy of the music from my iTunes library and some random videos.  I typically purchase new content on my main system and download to it.  Weekly I perform an rsync backup of my iTunes library from my main system to my first gen MacBook iTunes library.
  7. My first gen MacBook weekly (or whenever I add a substantial amount of content to it) performs an rsync of its iTunes library to Bingodisk.  Its iTunes library has my full collection — music, TV shows, movies, etc.
  8. S3 is used sparsely.  I know it’s supposed to be supremely reliable, but I have lots of issues with it timing out when copying large amounts of data to it.
  9. MobileMe account is used to store things like online receipts and various documents I like to keep handy.

All things considered, I view this as a fairly comprehensive backup strategy, and it is fairly easy to maintain.  For instance, to rsync from my main system to my first gen MacBook, I quickly mount the volume on my main system and then run this shell script:

rsync -a -u -v -F --exclude="*DS_Store*" /Users/username/music/itunes/"iTunes Music"/ /Volumes/Media/iTunes/

Then the script is very similar to rsync from my first gen MacBook to Bingodisk.  It also keeps it from transferring annoying DS_Store files on Mac systems.

I’m hoping to get a Drobo system in the near future to connect to my first gen MacBook and use it for most of my file serving needs and further simplify my backup process.

Anyone see something I’m missing or have any further tips to give me a better safety net?

Introducing: PHP Simple Cache

PHP Simple Cache is pretty self decribing.  It is a simple cache built for PHP powered websites that I have decided to release as open source.  It has a fairly narrow audience.  The most applicable website I can imagine for its usage would be:

  • Powered by PHP
  • Relatively static content, but still driven by a database / content management system
  • A need for reduced dynamic page loads / database calls

If that sounds like a site you operate, then by all means feel free to check out the PHP Simple Cache page I setup on Google Code.  If you’re interested in contributing to its development, let me know :)

WordPress 2.7 – "Coltrane"

WordPress 2.7 is out, and while I’m still playing with it, I do like what I see.  Here’s a video in case you’d like to see some more regarding it: