Custom Fields
Re-Envisioned
Support MB Settings Page get fields to page again

  • Creator
    Topic
  • #24322
    Resolved Martin Rybos
    Participant

    I’m going according to the tutorial

    
    //mainsettingspage
    // Register a theme options page
    
    // Register a theme options page
    add_filter( 'mb_settings_pages', function ( $settings_pages ) {
        $settings_pages[] = array(
            'id'          => 'pencil',
            'option_name' => 'pencil',
            'menu_title'  => 'Pencil',
            'icon_url'    => 'dashicons-edit',
            'style'       => 'no-boxes',
            'columns'     => 1,
            'tabs'        => array(
                'general' => 'General Settings',
                'design'  => 'Design Customization',
                'faq'     => 'FAQ & Help',
            ),
        );
        return $settings_pages;
    } );          
    //mainsettingspage
    
    add_filter( 'rwmb_meta_boxes', 'meta_box_group_demo_register' );
    function meta_box_group_demo_register( $meta_boxes ) {
        
    //mainsettingspage
    
     $meta_boxes[] = array(
            'id'             => 'general',
            'title'          => 'General',
            'settings_pages' => 'pencil',
            'tab'            => 'general',
            'fields' => array(
                array(
                    'name' => 'Logo',
                    'id'   => 'logo',
                    'type' => 'file_input',
                ),
                array(
                    'name'    => 'Layout',
                    'id'      => 'layout',
                    'type'    => 'image_select',
                    'options' => array(
                        'sidebar-left'  => 'https://i.imgur.com/Y2sxQ2R.png',
                        'sidebar-right' => 'https://i.imgur.com/h7ONxhz.png',
                        'no-sidebar'    => 'https://i.imgur.com/m7oQKvk.png',
                    ),
                ),
            ),
        );
        $meta_boxes[] = array(
            'id'             => 'colors',
            'title'          => 'Colors',
            'settings_pages' => 'pencil',
            'tab'            => 'design',
            'fields' => array(
                array(
                    'name' => 'Heading Color',
                    'id'   => 'heading-color',
                    'type' => 'color',
                ),
                array(
                    'name' => 'Text Color',
                    'id'   => 'text-color',
                    'type' => 'color',
                ),
            ),
        );
        $meta_boxes[] = array(
            'id'             => 'info',
            'title'          => 'Theme Info',
            'settings_pages' => 'pencil',
            'tab'            => 'faq',
            'fields'         => array(
                array(
                    'type' => 'custom_html',
                    'std'  => 'Having questions? Check out our documentation',
                ),
            ),
        );
    
      return $meta_boxes;
    }
    
    

    on frontend

    
    <?php 
        $value = rwmb_meta( $logo, ['object_type' => 'setting'], $pencil );//or general i tried
    ?>
    <body>
    <?php echo $value;   ?>
    

    I don’t understand. There is no echo there.
    url to page

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #24334
    Long Nguyen
    Moderator

    Hi Martin,

    Did you assign the variable to a value?

    $logo = 'logo';
    $pencil = 'pencil';

    Or add it directly in the helper function:

    $value = rwmb_meta( 'logo', ['object_type' => 'setting'], 'pencil' );

    #24338
    Martin Rybos
    Participant

    Easy. Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.