1

Good day I have built a child theme with demo pages.

I want to be able to import my demo pages built with Elementor.

The issue I am encountering is that it is not setting the Elementor header and footer automatically.

Does anyone have a fix for this

Quote Reply Report •••

I have used OCDI after import but no result

`function set_elementor_header_footer_as_global() { // Check if OCDI plugin is active if (class_exists('OCDI_Plugin')) { // Import the demo content using OCDI OCDI_Plugin::import_content();

    // Get the imported header and footer templates
    $header_template = get_page_by_title('Header Template');
    $footer_template = get_page_by_title('Footer Template');

    // Set header template as global
    if ($header_template) {
        update_post_meta($header_template->ID, '_elementor_template_type', 'header');
        update_post_meta($header_template->ID, '_elementor_edit_mode', 'builder');
    }

    // Set footer template as global
    if ($footer_template) {
        update_post_meta($footer_template->ID, '_elementor_template_type', 'footer');
        update_post_meta($footer_template->ID, '_elementor_edit_mode', 'builder');
    }

    // Clear Elementor cache
    if (class_exists('Elementor\Plugin')) {
        \Elementor\Plugin::$instance->files_manager->clear_cache();
    }

    // Output success message
    echo 'Elementor header and footer templates set as global.';
} else {
    // Output error message if OCDI plugin is not active
    echo 'OCDI plugin is not active.';
}

} `

Minithemes
  • 11
  • 2

0 Answers0