Let’s say you’ve just created you latest WordPress theme and you’re ready to package it up so you can distribute it. You’ll probably be including an export of demo content for your users to import so that their website looks like your themes demo.
However, you probably wont want to redistribute the images you use in the demo due to licencing issues, so what’s the easiest way to create an export file that provides your users with sample images instead of the ones used in your demo?
The first time I did this, I simply downloaded by uploads folder to my desktop and used the batch process tool in Photoshop. I selected the folder I wanted to process and then ran a task to fill each image with a solid colour. Once I’d filled in all the images I needed for the export I uploaded them to the demo site, replacing the original images.This method is pretty straight forward and means you don’t have to alter your export file at all.
The method I now use requires less time and and effort, and most importantly, it can be done by people who don’t have access to Photoshop. All you need to do is export your content from your demo site and open up the export file in your text editor or IDE. Personally, I use Netbeans. Once open I do a find replace on an image URL in the file using a regular expressions as the match type. Once I find an image URL in the file, I just replace it with a link to a test image and my server. You can see how this is done here:
Many editors allow you to use a regular expression to do a search. If yours doesn’t, I highly recommend Netbeans.
Hopefully this is useful to anyone developing themes wondering how to quickly create their dummy content files. Please let me know if you have a better method.