Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterHi,
Currently it's not possible yet. But you can add a separate meta box for WC products. I will look into the WC and will find if there's an API to integrate Meta Box fields for WC tabs.
Anh Tran
KeymasterCan you post your code here? I tested it many times before ๐
Anh Tran
KeymasterI've just tested with settings page and it works for me. Can you try in the browser private mode (with history and cookie cleared)? On some browsers like Firefox, the state of the inputs is saved by the browser, so if you open it once, it will be opened next time you access the page, regardless the settings.
Anh Tran
KeymasterHi,
This is a good idea! I've just added a new param for group "default_state" which accepts "collapsed" value. So you can see it collapsed by default.
Please update group to the latest version (1.2.8).
Anh Tran
KeymasterHi,
Do you mean the "full-height editor and distraction-free functionality" settings set in the screen options:

If it is, then it's not supported at the moment :(.
Anh Tran
KeymasterHi,
I think the easier way to change the wysiwyg is using
optionsparameter. Using filter is the last method you should think about. Of course this will work. I'll demonstrate both methods here:If you want to disable "Add Media" button, use this code:
array( 'type' => 'wysiwyg', 'name' => 'Editor', 'id' => 'test_editor', 'options' => array( 'media_buttons' => false, ), ),If you want to disable the text mode), use this code:
array( 'type' => 'wysiwyg', 'name' => 'Editor', 'id' => 'test_editor', 'options' => array( 'media_buttons' => false, 'quicktags' => false, ), ),If you want to disable visual mode, use this code:
array( 'type' => 'wysiwyg', 'name' => 'Editor', 'id' => 'test_editor', 'options' => array( 'media_buttons' => false, 'tinymce' => false, ), ),Using filter is similar:
add_filter( 'rwmb_wysiwyg_settings', function ( $settings ) { $settings['media_buttons'] = false; // $settings['tinymce'] = false; $settings['quicktags'] = false; return $settings; } );Note that using filter affects all wysiwyg fields. That's why it's more preferable to use field settings instead.
Anh Tran
KeymasterFYI, the new version 4.12 of Meta Box fixed this. Please update.
Anh Tran
KeymasterHi,
rwmb_meta( 'image_field_id' )returns an array of image info. To get the URL of the image, simply use the code like this:$image_info = rwmb_meta( 'image_field_id', 'size=thumbnail' ); echo $image_info['url']; // Thumbnail size URL echo $image_info['full_url']; // Full size URLAnh Tran
KeymasterCan you please try download again? I think I uploaded the wrong file.
Anh Tran
KeymasterHi,
We probably haven't supported it yet. The
user_roleactually is the role for being edited users. It's not for the current user, who is editing. We'll update the extension to add more condition for the current user.Anh Tran
KeymasterHi,
Just realized that you asked about a field, not a meta box. The include / exclude extension works for meta boxes only, not for fields.
So, in this situation, you probably need to use PHP code to check and register a field for a meta box. Something like:
$fields = array(); // Define all your fields here if ( current_user_can( 'manage_options' ) ) { $fields[] = array( 'type' => 'text', 'name' => 'Custom field for admin only', 'id' => 'admin_only', ); } // Register meta box $meta_boxes[] = array( 'type' => 'user', 'title' => 'Profile fields', 'fields' => $fields, );Anh Tran
KeymasterThe
user_roleis the role of the being edited users, not the current users. In this case, if you want to editeditorusers, you need to set'user_role' => 'editor'.Anh Tran
KeymasterYou can get file info with the helper function
RWMB_File_Field::file_info( $file ), like this:$group = rwmb_meta('media'); foreach($group as $data){ $files = rwmb_meta($data['mb_file']); foreach($files as $file) { $file_data = RWMB_File_Field::file_info( $file ); var_dump( $file_data ); } }Anh Tran
KeymasterHello,
Do you want to get list of custom post types or list of posts of some custom post types?
In 1st case, you can use the function get_post_types() to get all the post types:
$options = array(); $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ); foreach ( $post_types as $post_type ) { $options[$post_type->slug] = $post_type->name; }And in the select, just set
'options' => $options.In the 2nd case, you can use the field type
postand set'post_type' => 'your_post_type', and all the posts will be populated in the select option. For more info, please check this guide.June 21, 2017 at 5:01 PM in reply to: Clonable fields within clonable fields are not working with certain fields #6137Anh Tran
KeymasterJust updated the plugin with the fix you provided :).
Thanks for your contribution.
-
AuthorPosts