Forum Replies Created
-
AuthorPosts
-
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.
Anh Tran
KeymasterHi Hazmi, new versions for MB Settings Page is available. Please update. Let us know if you see any problem.
Thanks
Anh Tran
KeymasterHmm, does that work if you remove the field and use WordPress featured image instead?
Anh Tran
KeymasterHi Hazmi,
Please give us some hours to fix. Today or latest tomorrow we'll update the extension.
Just a small question: while testing with your code, we see the remove clone button works. Can you post your full code here to test?
Anh Tran
KeymasterHi Phil,
Thanks for your comment. We'll fix this bug soon.
Anh Tran
KeymasterUnfortunately, the plugin uses WordPress media API and upload folder to store files. We have put this feature request in the plan and will work on that later.
-
AuthorPosts