One click demo import is one of the most useful features that a WordPress theme can have. Users love to start the website development process at the same starting point as the theme demo page, so they can quickly develop the website they want. This plugin was created to make life of both theme authors and theme users easier.

The best feature of this plugin is, that theme authors can define demo imports for their themes and make it super easy for theme users to import everything. It's as simple as clicking one button!

Are you using a theme that is lacking One Click Demo Import? Suggest your theme author to add support. It will only take them 15 minutes!

How do theme author define these files? You can read more about that in the Basic import setup section below.

This plugin will create a submenu page under Appearance with the title Import demo data.

Do you want to contribute?

Please refer to the official GitHub repository of this plugin.

Subscribe to our mailing list

Sign up to our One Click Demo Import newsletter! We will only send you relevant demo import news (plugin updates, changes, improvements) and no spam (we hate spam). We are also working on something great... you won't have to think about demo imports anymore :)

Basic import setup

Which import files do we need?

There are four import files that you can prepare and use for your demo imports:

Note: the customizer settings will be imported only if the export file was created from the same theme.

How to predefine demo imports?

To predefine demo imports, you just have to add the following code structure, with your own values to your theme (using the pt-ocdi/import_files filter):

function ocdi_import_files() {
  return array(
    array(
      'import_file_name'           => 'Demo Import 1',
      'categories'                 => array( 'Category 1', 'Category 2' ),
      'import_file_url'            => 'http://www.your_domain.com/ocdi/demo-content.xml',
      'import_widget_file_url'     => 'http://www.your_domain.com/ocdi/widgets.json',
      'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer.dat',
      'import_redux'               => array(
        array(
          'file_url'    => 'http://www.your_domain.com/ocdi/redux.json',
          'option_name' => 'redux_option_name',
        ),
      ),
      'import_preview_image_url'   => 'http://www.your_domain.com/ocdi/preview_import_image1.jpg',
      'import_notice'              => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
      'preview_url'                => 'http://www.your_domain.com/my-demo-1',
    ),
    array(
      'import_file_name'           => 'Demo Import 2',
      'categories'                 => array( 'New category', 'Old category' ),
      'import_file_url'            => 'http://www.your_domain.com/ocdi/demo-content2.xml',
      'import_widget_file_url'     => 'http://www.your_domain.com/ocdi/widgets2.json',
      'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer2.dat',
      'import_redux'               => array(
        array(
          'file_url'    => 'http://www.your_domain.com/ocdi/redux.json',
          'option_name' => 'redux_option_name',
        ),
        array(
          'file_url'    => 'http://www.your_domain.com/ocdi/redux2.json',
          'option_name' => 'redux_option_name_2',
        ),
      ),
      'import_preview_image_url'   => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
      'import_notice'              => __( 'A special note for this import.', 'your-textdomain' ),
      'preview_url'                => 'http://www.your_domain.com/my-demo-2',
    ),
  );
}
add_filter( 'pt-ocdi/import_files', 'ocdi_import_files' );

You can set content import, widgets, customizer and Redux framework import files. You can also define a preview image and the preview URL, which will be used only when multiple demo imports are defined, so that the user will see the difference between imports. The import notice can be used, to notify the user and is displayed before the Import Demo Data button.

What about using local import files (from theme folder)?

You have to use the same filter as in above example, but with a slightly different array keys: local_*. The values have to be absolute paths (not URLs) to your import files. To use local import files, that reside in your theme folder, please use the below code. Note: make sure your import files are readable!

function ocdi_import_files() {
  return array(
    array(
      'import_file_name'             => 'Demo Import 1',
      'categories'                   => array( 'Category 1', 'Category 2' ),
      'local_import_file'            => trailingslashit( get_template_directory() ) . 'ocdi/demo-content.xml',
      'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'ocdi/widgets.json',
      'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'ocdi/customizer.dat',
      'local_import_redux'           => array(
        array(
          'file_path'   => trailingslashit( get_template_directory() ) . 'ocdi/redux.json',
          'option_name' => 'redux_option_name',
        ),
      ),
      'import_preview_image_url'     => 'http://www.your_domain.com/ocdi/preview_import_image1.jpg',
      'import_notice'                => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
      'preview_url'                  => 'http://www.your_domain.com/my-demo-1',
    ),
    array(
      'import_file_name'             => 'Demo Import 2',
      'categories'                   => array( 'New category', 'Old category' ),
      'local_import_file'            => trailingslashit( get_template_directory() ) . 'ocdi/demo-content2.xml',
      'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'ocdi/widgets2.json',
      'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'ocdi/customizer2.dat',
      'local_import_redux'           => array(
        array(
          'file_path'   => trailingslashit( get_template_directory() ) . 'ocdi/redux.json',
          'option_name' => 'redux_option_name',
        ),
        array(
          'file_path'   => trailingslashit( get_template_directory() ) . 'ocdi/redux2.json',
          'option_name' => 'redux_option_name_2',
        ),
      ),
      'import_preview_image_url'     => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
      'import_notice'                => __( 'A special note for this import.', 'your-textdomain' ),
      'preview_url'                  => 'http://www.your_domain.com/my-demo-2',
    ),
  );
}
add_filter( 'pt-ocdi/import_files', 'ocdi_import_files' );

More answers to your questions

This was just a short and quick intro on how to setup the One Click Demo Import for your users. Please visit this FAQ page, for more details about the plugin setup.

Screenshots

1. Example of multiple predefined demo imports, that a user can choose from.

Example of multiple predefined demo imports, that a user can choose from.

2. How the import page looks like, when only one demo import is predefined.

How the import page looks like, when only one demo import is predefined.

3. Example of how the import page looks like, when no demo imports are predefined a.k.a manual import.

Example of how the import page looks like, when no demo imports are predefined a.k.a manual import.

Changelog

The changelog is posted on the WP plugin page.