MB Settings Page set multi 'group' and 'clone', how to display in the frontend

Support › MB Settings Page › MB Settings Page set multi 'group' and 'clone', how to display in the frontend

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4101
    eboss99seboss99s
    Participant

    #4104
    Anh TranAnh Tran
    Keymaster

    You need to use multiple loops:

    $top_main_menus = get_post_meta( get_post_ID(), 'top_main_menu', true);
    if ( !empty( $top_main_menus ) ) {
        foreach ( $top_main_menus as $top_main_menu ) {
            $sub_top_main_menus = empty( $top_main_menu['sub_top_main_menus'] ) ? array() : $top_main_menu['sub_top_main_menus'];
            if ( ! empty( $sub_top_main_menus ) ) {
                foreach ( $sub_top_main_menus as $sub_top_main_menu ) {
                    $text = empty( $sub_top_main_menu['sub_main_menu'] ) ? '' : $sub_top_main_menu['sub_main_menu'];
                    $link = empty( $sub_top_main_menu['sub_menu_link'] ) ? '' : $sub_top_main_menu['sub_menu_link'];
    
                    echo $text;
                    echo $link;
                }
            }
        }
    }
    
    #4105
    eboss99seboss99s
    Participant

    I use the code you provided.
    The following message appears

    I use the "MB Settings Page", not for a single post.
    Do I need to add
    $ Settings = get_option ( 'my_options');
    Or should I use the
    get_term_meta ()

    How should I use?

    #4111
    Anh TranAnh Tran
    Keymaster

    Sorry, it should be get_option:

    $settings = get_option( 'my-option-menu' );
    $top_main_menus = isset( $settings['top_main_menu'] ) ? $settings['top_main_menu'] : array();
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘MB Settings Page set multi 'group' and 'clone', how to display in the frontend’ is closed to new replies.