Support » Plugin: One Click Demo Import » The assigned menu is not displayed

  • Hello!

    When importing does not put a tick on the selected menu, how to fix it?

    In your documentation, such code to address this issue:

    
    function ocdi_after_import_setup() {
        // Assign menus to their locations.
        <strong>$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
    
        set_theme_mod( 'nav_menu_locations', array(
                'main-menu' => $main_menu->term_id,
            )
        );</strong>
    
        // 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( 'pt-ocdi/after_import', 'ocdi_after_import_setup' );
    

    I write the following code

    function ocdi_after_import_setup() {
    // Assign menus to their locations.
    $main_menu = get_term_by( ‘name’, ‘Main Menu’, ‘main_menu’ );

    set_theme_mod( ‘nav_menu_locations’, array(
    ‘main-menu’ => $main_menu->term_id,
    )
    );

    // 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( ‘pt-ocdi/after_import’, ‘ocdi_after_import_setup’ );

    The code probably does not work because of ‘main-menu’ => $main_menu->term_id, what do I write instead of do this ‘main-menu’ or it does not affect what?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘The assigned menu is not displayed’ is closed to new replies.