Define multiple setting pages

Support MB Settings Page Define multiple setting pages

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3509
    87Pancakes87Pancakes
    Participant

    Hi,

    How do I create multiple setting pages?

    I'd like one for general settings and then one for a portfolio?

    Thanks in advance.

    Ben

    #3510
    87Pancakes87Pancakes
    Participant

    I figured this out;

    Here's the answer if anyone has the same question;

    <?php
    // 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'          => 'options',
    		'option_name' => 'options',
    		'menu_title'  => __( 'Options', 'textdomain' ),
    		'icon_url'    => 'dashicons-edit',
    		'style'       => 'no-boxes',
    		'columns'     => 1,
    		'tabs'        => array(
    			'general' => __( 'General Settings', 'textdomain' ),
    		),
    		'position'    => 2,
    	);
    	
    	$settings_pages[] = array(
    		'id'          => 'work',
    		'option_name' => 'work',
    		'menu_title'  => __( 'Work', 'textdomain' ),
    		'icon_url'    => 'dashicons-edit',
    		'style'       => 'no-boxes',
    		'columns'     => 1,
    		'tabs'        => array(
    			'featured' => __( 'Featured Work', 'textdomain' ),
    		),
    		'position'    => 2,
    	);
    	return $settings_pages;
    }
    // Register meta boxes and fields for settings page
    add_filter( 'rwmb_meta_boxes', 'prefix_options_meta_boxes' );
    function prefix_options_meta_boxes( $meta_boxes )
    {
    	$meta_boxes[] = array(
    		'id'             => 'general',
    		'title'          => __( 'General', 'textdomain' ),
    		'settings_pages' => 'options',
    		'tab'            => 'general',
    		'fields' => array(
    			array(
    				'name' => __( 'Logo Dark', 'textdomain' ),
    				'id'   => 'logo_dark',
    				'type' => 'file_input',
    			),
    			array(
    				'name' => __( 'Logo Light', 'textdomain' ),
    				'id'   => 'logo_dark',
    				'type' => 'file_input',
    			),
    
    		),
    	);
    	return $meta_boxes;
    }
    
    
    #3512
    Anh TranAnh Tran
    Keymaster

    Great that you made it!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Define multiple setting pages’ is closed to new replies.