• Resolved Sumon Hasan

    (@infodesignbd)


    Hello,
    When i import dummy data by using One Click Demo Import plugin. My all media file, widget data and redux theme option data imported properly but only pages and posts content import not working. pages and posts showing blank.

    Where is the problem ? Any fault in my code ? Please give me a solution if it’s possible.
    This is my one click demo import function code.

    <?php
    
    function my_theme_import_files() {
        return array(
            array(
                'import_file_name'             => esc_html__('Import Demo', 'my_theme'),
                'local_import_file'            => trailingslashit( get_template_directory() ) . 'libs/dummy-data/theme-demo-data.xml',
                'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'libs/dummy-data/widget-data.json',
                'local_import_redux'           => array(
                        array(
                            'file_path'   => trailingslashit( get_template_directory() ) . 'libs/dummy-data/redux-option.json',
                            'option_name' => 'my_theme_options',
                        ),
                    ),
                'import_preview_image_url'     => trailingslashit( get_template_directory() ) . 'screenshot.png',
            ),
        );
    }
    add_filter( 'pt-ocdi/import_files', 'my_theme_import_files' );
    
    function my_theme_after_import_setup() {
        // Assign menus to their locations.
        $main_menu = get_term_by( 'name', 'Primary', 'nav_menu' );
    
        set_theme_mod( 'nav_menu_locations', array(
                'primary' => $main_menu->term_id,
            )
        );
    
        // Assign front page and posts page (blog page).
        $front_page_id = get_page_by_title( 'Home-main' );
        $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', 'my_theme_after_import_setup' );
    
    function my_theme_demo_page_setup( $default_settings ) {
        $default_settings['parent_slug'] = 'themes.php';
        $default_settings['page_title']  = esc_html__( 'One Click Demo Import' , 'my_theme' );
        $default_settings['menu_title']  = esc_html__( 'Import Demo Data' , 'my_theme' );
        $default_settings['capability']  = 'import';
        $default_settings['menu_slug']   = 'ev-one-click-demo-import';
    
        return $default_settings;
    }
    add_filter( 'pt-ocdi/plugin_page_setup', 'my_theme_demo_page_setup' );
    add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Gregor Capuder

    (@capuderg)

    Hi,

    that’s very strange…

    So, the posts and pages did import (you can see the titles in WP), but the content of these posts and page are empty?

    Did this work before, or are you configuring the OCDI for the first time?

    The code above looks OK…

    What does the log file say?

    Take care!

    Thread Starter Sumon Hasan

    (@infodesignbd)

    Hi,
    Now it’s working properly. Maybe it was my local server problem. Thanks for your replay.

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi Hasan,

    I’m glad the problem is resolved.

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Media file imported but post and page content import not working’ is closed to new replies.