Custom Fields
Re-Envisioned
Support MB Settings Page Metabox labels not showing

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 2 months, 3 weeks ago.

  • Creator
    Topic
  • #15557

    twistedkaos
    Participant
    // Register settings page. In this case, it's a theme options page
    add_filter( 'mb_settings_pages', 'prefix_options_page' );
    function prefix_options_page( $settings_pages ) {
        $settings_pages[] = array(
            'id'          => 'client',
            'option_name' => 'client',
            'menu_title'  => 'Client Details',
            'icon_url'    => 'dashicons-edit',
            'style'       => 'no-boxes',
            'columns'     => 1,
            'parent'      => 'options-general.php',
            'tabs'        => array(
                'general' => 'General Settings',
                'social'  => 'Social Media',
                'my_settings'     => 'Settings',
            ),
            'position'    => 68,
        );
        return $settings_pages;
    }
    
    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array (
            'title' => 'Client details',
            'id' => 'client_fields',
            'settings_pages' => 'client',
            'context'        => 'normal',
            'priority'       => 'high',
            'tab'            => 'general',
            'fields' => array(
                array (
                    'id' => 'client_name',
                    'type' => 'text',
                    'name' => 'Client/Company Name',
                ),
                array (
                    'id' => 'client_address',
                    'type' => 'text',
                    'name' => 'Client Address',
                ),
                array (
                    'id' => 'client_address_2',
                    'type' => 'text',
                    'name' => 'Client Address 2',
                ),
                array (
                    'id' => 'client_city',
                    'type' => 'text',
                    'name' => 'Client City',
                ),
                array (
                    'id' => 'client_state',
                    'type' => 'text',
                    'name' => 'Client State',
                ),
                array (
                    'id' => 'client_zip',
                    'type' => 'text',
                    'name' => 'Client Zip',
                ),
                array (
                    'id' => 'client_phone',
                    'type' => 'text',
                    'name' => 'Client Phone',
                ),
                array (
                    'id' => 'client_email',
                    'type' => 'text',
                    'name' => 'Client Email',
                ),
                
            ),
            
        );
        $meta_boxes[] = array (
            'title' => 'Client Social',
            'id' => 'client_social',
            'settings_pages' => 'client',
            'context'        => 'normal',
            'priority'       => 'high',
            'tab'            => 'social',
            'fields' => array(
                array (
                    'id' => 'Facebook',
                    'type' => 'url',
                    'name' => 'Facebook URL',
                ),
                array (
                    'id' => 'instagram',
                    'type' => 'url',
                    'name' => 'Instagram URL',
                ),
                array (
                    'id' => 'twitter',
                    'type' => 'url',
                    'name' => 'Twitter URL',
                ),
                array (
                    'id' => 'Google Business',
                    'type' => 'url',
                    'name' => 'Google Business',
                ),
                array (
                    'id' => 'yelp',
                    'type' => 'url',
                    'name' => 'Yelp URL',
                ),
            ),
        );
        $meta_boxes[] = array (
            'title' => 'Client Settings',
            'id' => 'my_settings',
            'settings_pages' => 'client',
            'context'        => 'normal',
            'priority'       => 'high',
            'tab'            => 'my_settings',
            'fields' => array (
                    'id' => 'my_services',
                    'type' => 'switch',
                    'name' => 'Services',
                    'desc' => 'turn on services CTP',
                    'std' => 1,
                    'style' => 'rounded',
                ),
                array (
                    'id' => 'my_testimonials',
                    'type' => 'switch',
                    'name' => 'Testimonials',
                    'desc' => 'turn on Testimonials CTP',
                    'std' => 1,
                    'style' => 'rounded',
                ),
                array (
                    'id' => 'my_team_members',
                    'type' => 'switch',
                    'name' => 'Team Members',
                    'desc' => 'turn on Team Members CTP',
                    'std' => 1,
                    'style' => 'rounded',
                ),
                array (
                    'id' => 'my_faq',
                    'type' => 'switch',
                    'name' => 'FAQ',
                    'desc' => 'turn on FAQ CTP',
                    'std' => 1,
                    'style' => 'rounded',
                ),
            );
        return $meta_boxes;
    }
Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #15560

    Anh Tran
    Keymaster

    Hi,

    When the style for settings page is set no-boxes, meta boxes’ titles won’t show because there’s no box wrapper anymore. It’s the expected behavior.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.