Add One Click Demo Import Plugin In Your WordPress Theme

One Click Demo Import Plugin is a WordPress plugin that allows users to easily import demo content into their WordPress website. This plugin is very useful for web developers and site owners who want to quickly set up a website with pre-made content. It can save time and money by allowing users to quickly import demo content into their WordPress website.

Let’s think you are a WordPress theme developer and designer and you want to use “One Click Demo Import” to import your theme demo contents.

There is just three simple steps to do the job.

Step One – Export Your Demo Data

First of all, export your demo website data by following the plugins.

  • Data Export: Go to “Tools -> Export” in WordPress Dashboard. Export all data in XML format.
  • Widget Importer & Exporter: Install this plugin and export widgets with wie format.
  • Customizer Export: Install this plugin and export customizations from Customize section with dat format.

Upload these files in your host or add them to your theme folder. The standard way is, uploading them to your own host.

Step Two – Functions.php Codes

Add the following codes to your theme’s functions.php file.

function hs_import_files()
{
    return [
        [
            'import_file_name'           => __('Theme Name', 'text-domain'),
            'import_file_url'            => 'http://your-website.com/content.xml',
            'import_widget_file_url'     => 'http://your-website.com/widgets.wie',
            'import_customizer_file_url' => 'http://your-website.com/customizer.dat',
        ],
    ];
}
add_filter('ocdi/import_files', 'hs_import_files');

Step Three – Adjust Contents After Import

After importing demo data sometimes you need to adjust your theme like customization. Add the following code to the functions.php file.

function hs_ocdi_after_import_setup()
{
    // Assign menus to their locations.
    $main_menu = get_term_by('name', 'main menu', 'nav_menu');
    $social_menu = get_term_by('name', 'social menu', 'nav_menu');

    set_theme_mod(
        'nav_menu_locations',
        [
            'main-menu' => $main_menu->term_id, // replace 'main-menu' here with the menu location identifier from register_nav_menu() function in your theme.
            'social-menu' => $social_menu->term_id,
        ]
    );
}
add_action('ocdi/after_import', 'hs_ocdi_after_import_setup');

One Click Demo Import Plugin is a great way for users to quickly set up a website with pre-made content. It can save time and money by allowing users to quickly and easily import demo content into their WordPress website. The plugin is also very easy to use, and the customization options allow users to make the content their own. It is a great tool for web developers and site owners who want to quickly set up a website with pre-made content.

Shopping Cart