cmb2-attached-posts icon indicating copy to clipboard operation
cmb2-attached-posts copied to clipboard

The “show_on” filter doesn’t work in attaching posts with CMB2

Open bassakirou opened this issue 7 years ago • 1 comments

Hi,

I am very satisfied with CMB2. But the “show_on” filter doesn’t work in attaching posts with CMB2. It seems that it’s not included in your add-on. How can I do to show attaching posts in specific page template ?

Best regards.

bassakirou avatar Jul 11 '17 14:07 bassakirou

Did you try with show_on_cb:

$feed_mb = new_cmb2_box( array(
	'id'           => 'prefix_my_id',
	'title'        => __( 'This is my title', 'cmb2' ),
	'object_types' => array( 'page' ), // Post type
	'context'      => 'normal',
	'priority'     => 'high',
	'show_names'   => false, // Show field names on the left
	'show_on_cb'   => 'cmb_only_show_for_my_page',
	// Or for OO 
	//'show_on_cb' 	 => array(__CLASS__, 'cmb_only_show_for_my_page'),
) ); 

pabamato avatar May 17 '18 22:05 pabamato