One of the most frustrating things for buyers of commercial themes is when they activate a theme on their site and it looks nothing like the theme demo. Theme demos are created to show off the theme in the best possible light so theme companies spend a long time filling it with demo content and stock images to give it the wow factor – they want to highlight as many of the theme features as possible and customers will base their buying decision on seeing the demo site and imagining how it will look with their content and branding so it can be quite disappointing when they finally purchase it and activate it on their website and they see a bland layout that looks nothing like the demo.
I have reviewed probably hundreds of themes over the years here on WPLift as well as created my own themes so I think I have a good feel for how themes are usually set up but even then I will be stumped sometimes and have to delve through documentation to find out how a particular theme is setup – there really should be a standard way of doing this but there isn’t at the moment. Some themes will rely on placing widgets to create a custom homepage, some will require certain pages to be created with shortcodes placed and others will use custom page templates and so on.
Personally when we create our themes, I include a sample data folder with an import file which will import all the content from our demo site, including images ( I will only use images which have GPL / Creative Commons license) so people can get the exact images from our demo site, some themes that use images with different licenses will include blank images in the sample data which will obivously make the theme look quite bland.
There are also custom import tools that some themes use which are for more convoluted themes which will place specific widgets, create shortcodes etc. In today’s post Im going to look at some of the options available to theme developers to try and make this process as easy as possible for the end-user.
Sample Data with WordPress Export / Import
WordPress has a built-in Export and Import system designed to help you move content from one WordPress site to another.
I believe this is the best way to allow the user to import all content from your demo site – by creating an import file you let the customer add all posts, pages, custom post type content, images, categories, tags and comments from your demo site. Once you have setup your demo site, export the data by going to “Tools” > “Export” and choose which content you want to export. If there is content from plugins you dont want includedm then deactivate them first before doing the export, otherwise the user will get an error if they dont have that plugin installed.
For the user to then import your data, they visit “Tools” > “Import” and will need to install the WordPress importer plugin, after which they can then upload your file to import the content.
Article continues after this block
Handling Required / Recommended Plugins
A good way to add functionality to your WordPress theme is to require or recommend certain plugins, this is better than just including all the functionality into the theme itself via the functions.php file as users will not be subject to content-lock in, that is they can change themes and content will remain rather then being reliant on your theme. The best way to do this is to use the TGM Plugin Activation PHP library by Thomas Griffin.
Using this in your theme is fairly simple, you drop the class file into your theme directory and call it from functions.php then create a hook which registers the plugins and configuration. You can grab the file and see full instructions on the site here.
After activating your theme, the user will see a list of required and recommended plugins and can choose to activate the ones they want or all of them in bulk.
Widget Importer & Exporter
If your theme relies on specific widgets being placed for functionality then there is a plugin called “Widget Importer & Exporter” created by Steven Gliebe which you can use to export your widget placements and content into a file with .wie extension which the customer can then use the same plugin to import them, if they are using the same theme then they will get an identical widget setup to your demo site.
To use this grab the free plugin, create your widget setup as usual and then visit “Tools” > “Widget Importer & Exporter” and export the file.
This is a really handy plugin – it would be nice though to see this functionality built-in to the WordPress Importer itself.
Theme Customizer Export / Import
We don’t tend to use this in our themes as we set default options for the theme customizer which the user can then tweak to their liking but for some themes which include a lot of options here it will be useful to also offer some demo data which is where the Customizer Export / Import plugin can be used. This works the same as the WordPress Exporter and the Widget Exporter, simply choose your options and export the file.
One-Click Demo Setup
Finally, for themes that require a more complex setup that use a theme options panel ( Redux Framework, NHP Options Framework or Radium Framework ) I found the Radium One-Click Demo install library.
Using this will allow you to import demo content generated using the WordPress Content Exporter plugin, widget content generated using the Widget Importer Exporter plugin. ( Rename it from .wie to .json ) and theme_options.txt – generated using the theme options frameworks such as Redux Framework, NHP Options Framework or Radium Framework and will also allow you to auto-create menus.
To use it, follow these steps :
- Add require get_template_directory() .’/radium-one-click-demo-install/init.php’; to your theme’s function.php
- Copy the files generated above into demo-files/.
- Modify what menus need to be loaded in the Radium_Theme_Demo_Data_Importer class located in init.php as well as the theme options name to be used.
- A new menu should appear under Appearance -> Import Demo Data
- Click the import button
Setting up a theme shouldn’t be a complex task for the user, If I sometimes struggle to get a demo set up with a new theme, imagine the difficulty a new user will have. By standardizing this process you can make it easier for them and also cut down on support costs associated with first time setups.
With the methods above it should be fairly easy as long as the steps are indicated clearly in documentation or a quick walk though video. The problems will arise when theme companies use propriety options panels or system that require complicated shortcodes being placed to function. Personally I hate having to place shortcodes to get a theme looking how it supposed to – a problem when certain page builders are used.
What do you think ? How do you handle theme setup for customers ?