A to Z Tutorial: How to install One Click Demo Import WP Plugin

If you get interested in WordPress theme features, you must know One Click Demo Import – one of the most popular & useful plugins. If you are a theme author, you will want to allow your users to setup their theme fast & easily. This powerful tool will support to import demo content, widgets and theme settings with just 1 click. Comprehending its important function, WpOpal would like to introduce A to Z Tutorial: How to install One Click Demo Import WP Plugin. Let’s enable 1-click installation for your theme demo data!

How to install One Click Demo Import WP Plugin

How To Install One Click Demo Import WP Plugin

1. From WordPress Dashboard

Step 1: go to ‘Plugins‘ -> ‘Add New
Step 2: search ‘One Click Demo Import‘ plugin & install it
Step 3: activate the plugin from ‘Plugins‘ page

2. From WordPress.org

Step 1: download ‘One Click Demo Import‘ plugin
Step 2: upload ‘one-click-demo-import‘ directory to ‘/wp-content/plugins/‘ directory with methods such as fpt, sftp, scp, etc.
Step 3: activate the plugin from ‘Plugins‘ page

Finally, you can find the import page in your wp-admin by visiting ‘Appearance‘ -> ‘Import Demo Data‘.

1 click Import Demo Data Button

Some Common Requirements To Use 1-click Demo Import

– Import all posts, pages, menus, custom fields, widgets & customizer settings
– Auto assign the theme location for the custom menus & set the front page
– Import the Revolution Slider demo in needed

Correspondingly, there are some basic import files you need to prepare for this plugin. You should upload:

– Demo content XML file
– Widgets WIE or JSON file created by Widget Importer & Exporter plugin
– Customizer settings DAT file generated from Customizer Export/Import plugin (only imported if the export file is from the same theme)
– Redux framework settings Json file generated from Redux Framework plugin.

Note: Except the first file upload input is required, the others are optional.

Import page with no predefined demo imports

For Theme Author

1. Predefine Demo Import

Using the pt-ocdi/import_files filter, you should insert the following code structure with your values to the theme.

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’ );

Beside content, widgets, customizer and Redux framework, you can set a preview image and the preview URL. Thus, users can see the difference between multiple defined demo imports and view the demo site appearance. Also, you can assign categories to separate demo imports for quick & easy search.

Import page with multiple predefined demo imports

2. Assign ‘Front Page’, ‘Posts Page’ & Menu Location Automatically

You can add this code structure with with the pt-ocdi/after_import action hook.

function ocdi_after_import_setup() {
// Assign menus to their locations.
$main_menu = get_term_by( ‘name’, ‘Main Menu’, ‘nav_menu’ );

set_theme_mod( ‘nav_menu_locations’, array(
‘main-menu’ => $main_menu->term_id,
)
);

// Assign front page and posts page (blog page).
$front_page_id = get_page_by_title( ‘Home’ );
$blog_page_id = get_page_by_title( ‘Blog’ );

update_option( ‘show_on_front’, ‘page’ );
update_option( ‘page_on_front’, $front_page_id->ID );
update_option( ‘page_for_posts’, $blog_page_id->ID );

}
add_action( ‘pt-ocdi/after_import’, ‘ocdi_after_import_setup’ );

3. Use Local Import Files

To use local import files from your theme folder, you can use the below code.

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’ );

For Theme User

It’s easy for any new theme user to setup the website to look as the theme demo. All they need is clicking on the ‘Import Demo Data‘ button. Then, enjoy the best feature of One Click Demo Import WP Plugin.

In the case the theme doesn’t support the plugin, users still can use it. However, they will have to find all the files to upload them manually. It would be better if theme users can contact the them author and request for support.

To find the author of your theme, please go to ‘Appearance‘ -> ‘Themes‘. Next, click on ‘Theme Details‘ to get more details of the author.

contact theme author for implementing 1 click demo import

>> Quick Steps To Install Sample Data
>> Replicate WordPress theme demos with 1-click Installation 

One Click Demo Installation is necessary for any user-friendly WordPress theme to enable theme users replicate sample data in no time. Therefore, this guide: How to install One Click Demo Import WP Plugin will be useful for both theme authors & theme users.

>> Check more interesting tutorial blogs and video guides!

Share this: