Webcreations907 / WBC-Importer-extension

One click demo content importer extension for Reduxframework
GNU General Public License v2.0
66 stars 39 forks source link

menu is not setting up after import #81

Open hozyali opened 7 years ago

hozyali commented 7 years ago

Hi,

So far, the great plugin for one-click import. Thanks for the hard work.

revslider and homepage are correctly being set after import, however menu is not setting. I have two menus to be set after import.

1- Header Menu (its a menu name in appearance > menus) 2- Accounts (its a menu name in appearance > menus)

the menu locations are registered in my theme

register_nav_menus(array(
            'primary' => __('Primary Menu', 'domain'),
        ));
        register_nav_menus(array(
            'secondary' => __('Secondary Menu', 'domain'),
        ));

Here is my code.

$wbc_menu_array = array('demo1', 'demo2', 'demo3', 'demo4', 'demo5', 'demo6');
        if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && in_array($demo_active_import[$current_key]['directory'], $wbc_menu_array)) {
            $top_menu = get_term_by('name', 'Header Menu', 'nav_menu');
            $sec_menu = get_term_by('name', 'Accounts', 'nav_menu');

            if (isset($top_menu->term_id)) {
                set_theme_mod('nav_menu_locations', array(
                    'primary' => $top_menu->term_id,
                    'secondary' => $sec_menu->term_id
                        )
                );
            }
        }

The menus are well imported through the content xml file, but just not setting in the proper locations.

Any help will be highly appreciated.

Thanks again

nrkhatana commented 6 years ago

I have the same problem, do anyone have any solution for this?

nrkhatana commented 6 years ago

Problem is arising in php 7.x working fine on 5.x