Support Forum
Support › Meta Box Conditional Logic › Problem with image_advanced field
i have 2 issues with your extenstions.
1. Here is my code
array(
'name' => WR_Nitro::_( 'Background Image' ),
'id' => 'mb_bg_image',
'type' => 'image_advanced',
'hidden' => array( 'mb_type', '=', 'product' ),
),
array(
'name' => WR_Nitro::_( 'Background Repeat' ),
'id' => 'mb_bg_image_repeat',
'type' => 'select',
'options' => array(
'no-repeat' => WR_Nitro::_( 'No Repeat' ),
'repeat' => WR_Nitro::_( 'Repeat' ),
'repeat-x' => WR_Nitro::_( 'Repeat X' ),
'repeat-y' => WR_Nitro::_( 'Repeat Y' ),
),
'visible' => array( 'mb_bg_image', '>', 0 )
),
array(
'name' => WR_Nitro::_( 'Background Size' ),
'id' => 'mb_bg_image_size',
'type' => 'select',
'options' => array(
'auto' => WR_Nitro::_( 'auto' ),
'cover' => WR_Nitro::_( 'Cover' ),
'contain' => WR_Nitro::_( 'Contain' ),
'initial' => WR_Nitro::_( 'Initial' ),
),
'visible' => array( 'mb_bg_image', '>', 0 )
)
when 'mb_bg_image' field is has file, 'mb_bg_image_repeat' and 'mb_bg_image_size' doesn't display
2. See video and code below: https://youtu.be/-nrnX95WeFM
$meta_boxes[] = array(
'id' => 'wr_post_option',
'post_types' => array( 'post' ),
'title' => WR_Nitro::_( 'Post Settings' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => WR_Nitro::_( 'Enable large post' ),
'id' => 'masonry_large',
'type' => 'checkbox',
'desc' => WR_Nitro::_( '<br /><i>Support Masonry layout only</i>' ),
'std' => 0,
),
array(
'name' => WR_Nitro::_( 'Add image gallery' ),
'id' => 'format_gallery',
'type' => 'image_advanced',
),
array(
'name' => WR_Nitro::_( 'Video Source' ),
'id' => 'format_video',
'type' => 'select',
'options' => array(
'link' => WR_Nitro::_( 'Video Link' ),
'file' => WR_Nitro::_( 'Video Upload File' ),
),
),
array(
'name' => WR_Nitro::_( 'Video Link' ),
'id' => 'format_video_url',
'desc' => WR_Nitro::_( '(Support Youtube and Vimeo video)' ),
'type' => 'oembed',
'visible' => array( 'format_video', '=', 'link' ),
),
array(
'name' => WR_Nitro::_( 'Upload video' ),
'id' => 'format_video_file',
'desc' => WR_Nitro::_( 'Support .mp4 file format only' ),
'type' => 'file_advanced',
'max_file_uploads' => 1,
'mime_type' => 'video',
'visible' => array( 'format_video', '=', 'file' ),
),
array(
'name' => WR_Nitro::_( 'Audio Source' ),
'id' => 'format_audio',
'type' => 'select',
'options' => array(
'link' => WR_Nitro::_( 'Soundcloud Link' ),
'file' => WR_Nitro::_( 'Upload audio' ),
),
),
array(
'name' => WR_Nitro::_( 'Soundcloud Link' ),
'id' => 'format_audio_url',
'type' => 'oembed',
'visible' => array( 'format_audio', '=', 'link' ),
),
array(
'name' => WR_Nitro::_( 'Upload Audio' ),
'id' => 'format_audio_file',
'desc' => WR_Nitro::_( 'Support .mp3 file format only' ),
'type' => 'file_advanced',
'max_file_uploads' => 1,
'mime_type' => 'audio',
'visible' => array( 'format_audio', '=', 'file' ),
),
array(
'name' => WR_Nitro::_( 'Quote content' ),
'desc' => WR_Nitro::_( 'You can write the Quote content here.' ),
'id' => 'format_quote_content',
'type' => 'textarea',
'cols' => '30',
'rows' => '6',
),
array(
'name' => WR_Nitro::_( 'Quote author' ),
'id' => 'format_quote_author',
'type' => 'text',
'clone' => false,
),
array(
'name' => WR_Nitro::_( 'Link to' ),
'id' => 'format_link_url',
'type' => 'text',
),
)
);
Hi Bravebits,
This bug is the compatilibity bug with Conditional Logic addon and Meta Box plugin. We're in progress to fix this bug, will be released within 2 days.
Btw, I've tested with your provided code and it works properly, perhaps your provided code not same as your code you're testing in video.
Thanks for your patience.
Tan Nguyen
i have just updated to latest version of this extension (1.0.8) but all bugs seem to be not fixed, Check again please.
About video this is all code of this file: http://pastebin.com/Dwmpq39T
p/s: some functions serve for our product you can remove it and check
Thank you
Hi bravebits,
This bug caused when Meta Box 4.6 use new structure for File Advanced and Image Advanced, we're fixing this bug. If you want to fix immediately, please replace this file:
https://github.com/rilwis/meta-box/blob/0054dce58a359d71058c057190965afc62da1631/js/media.js
I'm looking to your code and will reply you soon.
Hi Bravebits,
I've test with your meta boxes again. It seems that you not use use Meta Box as normally way (You extends Meta Box class, then do some change inside), so I can't tell you your problem with your code but I can make sure that it works properly if you register as normal way, like this guide:
https://metabox.io/docs/registering-meta-boxes/
Also, you don't have to use rwmb_outside_conditions
filter. You can use that filter if you want to hide some element outside meta box. For example: post title, categories, post excerpt, etc...
I have modified your code, you can put this to your theme functions.php to see it works:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes )
{
// Additional meta box for post.
$meta_boxes[] = array(
'id' => 'wr_post_option',
'post_types' => array( 'post' ),
'title' => _( 'Post Settings' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => _( 'Enable large post' ),
'id' => 'masonry_large',
'type' => 'checkbox',
'desc' => _( '<i>Support Masonry layout only</i>' ),
'std' => 0,
),
array(
'name' => _( 'Add image gallery' ),
'id' => 'format_gallery',
'type' => 'image_advanced',
'visible' => array( 'post_format', 'gallery' )
),
array(
'name' => _( 'Video Source' ),
'id' => 'format_video',
'type' => 'select',
'options' => array(
'link' => _( 'Video Link' ),
'file' => _( 'Video Upload File' ),
),
'visible' => array( 'post_format', 'video' ),
),
array(
'name' => _( 'Video Link' ),
'id' => 'format_video_url',
'desc' => _( '(Support Youtube and Vimeo video)' ),
'type' => 'oembed',
'visible' => array( 'format_video', '=', 'link' ),
),
array(
'name' => _( 'Upload video' ),
'id' => 'format_video_file',
'desc' => _( 'Support .mp4 file format only' ),
'type' => 'file_advanced',
'max_file_uploads' => 1,
'mime_type' => 'video',
'visible' => array( 'format_video', '=', 'file' ),
),
array(
'name' => _( 'Audio Source' ),
'id' => 'format_audio',
'type' => 'select',
'options' => array(
'link' => _( 'Soundcloud Link' ),
'file' => _( 'Upload audio' ),
),
'visible' => array( 'post_format', 'audio' ),
),
array(
'name' => _( 'Soundcloud Link' ),
'id' => 'format_audio_url',
'type' => 'oembed',
'visible' => array( 'format_audio', '=', 'link' ),
),
array(
'name' => _( 'Upload Audio' ),
'id' => 'format_audio_file',
'desc' => _( 'Support .mp3 file format only' ),
'type' => 'file_advanced',
'max_file_uploads' => 1,
'mime_type' => 'audio',
'visible' => array( 'format_audio', '=', 'file' ),
),
array(
'name' => _( 'Quote content' ),
'desc' => _( 'You can write the Quote content here.' ),
'id' => 'format_quote_content',
'type' => 'textarea',
'cols' => '30',
'rows' => '6',
'visible' => array( 'post_format', 'quote' ),
),
array(
'name' => _( 'Quote author' ),
'id' => 'format_quote_author',
'type' => 'text',
'clone' => false,
'visible' => array( 'post_format', 'quote' ),
),
array(
'name' => _( 'Link to' ),
'id' => 'format_link_url',
'type' => 'text',
'visible' => array( 'post_format', 'link' ),
),
)
);
return $meta_boxes;
} );
Regards
Tan Nguyen
Hi,
issue #1 is still faulty (releated to image_advanced field)
Hi,
Please change mb_bg_image_repeat
and mb_bg_image_size
to something do not contains mb_bg_image
. For example: foo_repeat
, foo_size
.
Regards
it's work fine now. Thanks for your help
Regards,