Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • If I understand the problem you’re encountering then the adjustment is fairly straight forward. By default the only post type that will call the meta boxes by default are “post.” When you add a second, third, nth…. meta box you have to also, explicitly, say which post types you want to apply the meta box (in this case the “advanced fields”) to.

    Add this line underneath ‘title’ => __( ‘Advanced Fields’, ‘rwmb’ ), in your demo.php (or whatever you decided to call it). I added pages and “my_custom_post_type” to the array.

    // Post types, accept custom post types as well - DEFAULT is array('post'). Optional.
    		'pages' => array( 'post', 'page', 'my_custom_post_type' ),

    So it will appear like this

    // 2nd meta box
    	$meta_boxes[] = array(
    
    		// Meta box id, UNIQUE per meta box. Optional since 4.1.5
    		'id' => 'advanced',
    
    		'title' => __( 'Advanced Fields', 'rwmb' ),
    
    		// Post types, accept custom post types as well - DEFAULT is array('post'). Optional.
    		'pages' => array( 'post', 'page', 'my_custom_post_type' ),
    
    		'fields' => array(
    			// HEADING
    			array(
    				'type' => 'heading',
    				'name' => __( 'Heading', 'rwmb' ),
    				'id'   => 'fake_id', // Not used but needed for plugin
    			),
    ...

    Is that what you’re looking for?

    This was very helpful! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)