How to Display Metaboxes According to the Current Post Format

Support General How to Display Metaboxes According to the Current Post Format

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4649
    ismailismail
    Participant

    Hi,

    I already purchased developer bundle. How can i display Metaboxes according to the current post format:
    ‘aside’, ‘video’, ‘gallery’,’quote’,’audio’,’status’,’link’

    Thanks
    ismail

    #4650
    Tan NguyenTan Nguyen
    Participant

    Dear ismail,

    There're 3 extensions for you to do that, for easiest option, try MB Conditional Logic. The documentation here:

    https://metabox.io/docs/meta-box-conditional-logic/

    In the documentation example, I've included example how to display meta box based on post format. You can try:

    'visible' => ['post_format', 'aside']

    #4651
    ismailismail
    Participant

    Hi,

    At first thank you for your reply. I tried your examples given here:
    https://metabox.io/docs/meta-box-conditional-logic/

    But conditional login is not working anymore. Please help me.

    Thanks
    ismail

    #4652
    Tan NguyenTan Nguyen
    Participant

    Can you please post your code here?

    #4653
    ismailismail
    Participant

    Hi,

    I just copied the following code from
    https://metabox.io/docs/meta-box-conditional-logic/

    Code:

    add_filter( 'rwmb_meta_boxes', function( $meta_boxes )
    {
    	$meta_boxes[] = array(
    		'id' => 'brand_product',
    		'title' => 'Brands and Products',
    		'post_types' => array( 'post', 'page' ),
    		'context'	=> 'normal',
    		'priority'	=> 'high',
    		// Conditional Logic can be applied to Meta Box
    		// In this example: Show this Meta Box by default. Hide it when post format is aside
    		'hidden' => array( 'post_format', 'aside' ),
    		'fields' => array(
    			array(
    				'id'	=> 'brand',
    				'name'	=> 'Brand',
    				'desc'	=> 'Pick Your Favourite Brand',
    				'type'	=> 'select',
    				'options' => array(
    					'Apple' 		=> 'Apple',
    					'Google' 		=> 'Google',
    					'Microsoft' 	=> 'Microsoft'
    				)
    			),
    			array(
    				'id' 	=> 'apple_products',
    				'name'	=> 'Which Apple product that you love?',
    				'type'	=> 'radio',
    				'options' => array(
    					'iPhone' 	=> 'iPhone',
    					'iPad'		=> 'iPad',
    					'Macbook'	=> 'Macbook',
    					'iWatch'	=> 'iWatch'
    				),
    				// Conditional Logic can applied to fields
    				// In this example: Show this field by default, 
    				// hide it when user selected different value than 'Apple' on brand select field
    				'hidden' => array( 'brand', '!=', 'Apple' )
    			)
    		)
    	);
    	return $meta_boxes;
    } );

    Thanks
    ismail

    #4673
    ismailismail
    Participant

    Hi, now problem solved.

    Thanks
    ismail

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to Display Metaboxes According to the Current Post Format’ is closed to new replies.