Title: Hello, help please
Last modified: March 31, 2021

---

# Hello, help please

 *  Resolved [arzubrov](https://wordpress.org/support/users/arzubrov/)
 * (@arzubrov)
 * [5 years ago](https://wordpress.org/support/topic/hello-help-please/)
 * Hello, help please can you help I was looking for everything but could not solve
   the problem
 * I wanted to write a simple code that makes a simple import, this is an import
   of demo content without category and (Redux)
 *  only want to import and all this from the theme folder locally
 * demo-content.xml
    widgets.wie customizer.dat
 * choose a site logo
 * and select Home page (slug page home-1)
    and select Blog page (slug page blog-
   1)
 * but after import it gives an error
 * —Importing widgets—
    Error: Widget import data could not be read. Please try 
   a different file.
 * —Importing customizer settings—
    Error: The customizer import file is not in 
   a correct format. Please make sure to use the correct customizer import file.
 * =================
 * here is my code can you help?
 *     ```
       function ocdi_import_files() {
           return array(
               array(
                   'import_file_name'             => 'Demo Import 1',
                   'categories'                   => array( 'Demo 1' ),
                   'local_import_file'            => trailingslashit( get_template_directory() ) . 'ocdi/demo-content.xml',
                   'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'ocdi/widgets.wie',
                   'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'ocdi/customizer.dat',
                   'local_import_preview_image_url'     => 'ocdi/preview_import_image.png',
                   'import_notice'                => __( 'Make sure all required plugins are activated before you start. After importing this demo, you will have to configure some settings separately.', 'your-textdomain' ),
                   'preview_url'                  => 'http://www.your_domain.com/my-demo-1',
               ),
           );
       }
       add_filter( 'pt-ocdi/import_files', 'ocdi_import_files' );
       add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [5 years ago](https://wordpress.org/support/topic/hello-help-please/#post-14262597)
 * Hi [@arzubrov](https://wordpress.org/support/users/arzubrov/),
 * the code looks good. You can also recheck it with our documentation page: [https://ocdi.com/advanced-integration-guide/](https://ocdi.com/advanced-integration-guide/)
 * Did you use the correct plugins to export the Widgets and Customizer files? More
   info here: [https://ocdi.com/quick-integration-guide/#import-files](https://ocdi.com/quick-integration-guide/#import-files)
 * I’ve just retested the exports for widgets and customizer -> the import of those
   files works just OK.
 * Maybe recheck those files or even export them again, to be sure.
 * Take care!
 *  Thread Starter [arzubrov](https://wordpress.org/support/users/arzubrov/)
 * (@arzubrov)
 * [5 years ago](https://wordpress.org/support/topic/hello-help-please/#post-14264440)
 * Hello, you helped a lot, I tried on a different theme (template), everything 
   worked, thanks a lot.
 * Now there is 1 problem left after import, I would like to automatically select
   Home and blog page, I found the code but don’t know how to apply my pages
    Homepage
   URL (home-1) Blog Page URL (Blog-1)
 * How to add these pages to this code
 *     ```
       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', [
                   'main-menu' => $main_menu->term_id, // replace 'main-menu' here with the menu location identifier from register_nav_menu() function in your theme.
               ]
           );
   
           // 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( 'ocdi/after_import', 'ocdi_after_import_setup' );
       ```
   
 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [5 years ago](https://wordpress.org/support/topic/hello-help-please/#post-14268558)
 * Hi [@arzubrov](https://wordpress.org/support/users/arzubrov/),
 * the code you are referring to looks good, you just need to replace a few parts.
 * If you don’t need to assign a menu to a certain menu location you can remove 
   these few lines:
 *     ```
       // Assign menus to their locations.
       $main_menu = get_term_by( 'name', 'Main 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.
          ]
       );
       ```
   
 * For the homepage and blog page just edit these lines:
 *     ```
       // Assign front page and posts page (blog page).
           $front_page_id = get_page_by_title( 'Home' );
           $blog_page_id  = get_page_by_title( 'Blog' );
       ```
   
 * Replace the ‘Home’ with the page title of your home page. and replace the ‘Blog’
   with the page title of your blog page. That should do the trick.
 * Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Hello, help please’ is closed to new replies.

 * ![](https://ps.w.org/one-click-demo-import/assets/icon-256x256.png?rev=2506685)
 * [One Click Demo Import](https://wordpress.org/plugins/one-click-demo-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/one-click-demo-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/one-click-demo-import/)
 * [Active Topics](https://wordpress.org/support/plugin/one-click-demo-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/one-click-demo-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/one-click-demo-import/reviews/)

## Tags

 * [ocdi](https://wordpress.org/support/topic-tag/ocdi/)

 * 3 replies
 * 2 participants
 * Last reply from: [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/hello-help-please/#post-14268558)
 * Status: resolved