Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterHi David,
The long term for MB Frontend Submission is making it works with any kind of object and any kind of data storage. Your proposal is a nice trick. I will try to implement it and see how it works ๐
Anh Tran
KeymasterI partly understand :).
The logic behind saving state for collapsible groups is quite simple that you can do similarly. Just add a hidden field to the group and use the CSS class to access to that field to set/change value. Because it's an actual field, the value will be saved when the group is saved.
Hope that helps!
Anh Tran
KeymasterHi,
Yes, it's possible.
The collapsible groups have collapsed / expanded state. You can set the default state via
'default_state' => 'collapsed'and make the group saves its state with'save_sate' => true.Anh Tran
KeymasterHi,
Please just add a setting
'clone_default' => trueto fields if you want them to have 'std' value when cloning. If you clone a group and want to keep 'std' value for sub fields, please add that setting to all sub field.Anh Tran
KeymasterHi,
No problem. We're working on this.
Anh Tran
KeymasterHi David,
Thanks a lot for your reply. I've looked at the database structure of Posts2Posts and it's quite similar to your 2nd table structure. I will try to implement this feature as soon as I can.
Thanks,
AnhAnh Tran
KeymasterHi David,
Thanks a lot for your examples. That makes the picture a lot clearer. I will read more about this (probably Posts 2 Posts is the best one in WP ecosystem, right?). In the mean time, would you mind sharing how you have implemented a solution before?
Anh Tran
KeymasterHi David,
Thanks for a great question.
Currently, the way Meta Box and extensions work are one-way relationship. You can use a field "post" to attach 1 or many posts to a post. That's similar to 1-1 and 1-many relationship, but just one way.
The MB Custom Table does the storing job only. So if you create a custom table with 2 columns ID and related_posts, you can store related posts for a single post. And you can query the related posts via helper functions.
I've been thinking about relationship, but I'm not too clear about the usage of that in the situation of WordPress. Would you mind describe what you need and let's work on a good solution?
Anh Tran
KeymasterGreat! Happy holidays ๐
Anh Tran
KeymasterHi, can you please give me more info about the "dynamic options"? And the clone ID you're talking about is the ID of inputs in the group?
Anh Tran
KeymasterI've found the bug and fixed it in version 1.2.12 of Group extension. Please update.
December 6, 2017 at 8:40 AM in reply to: โ Refresehing the whole WP Admin Panel after settings saved #7767Anh Tran
KeymasterHi G.,
I guess I understand your point. Probably the code that saves data happens after your code that hides menus, metaboxes, etc. Would you please post your code here so I can debug that?
Anh Tran
KeymasterHi,
For your needs, the
image_selectfield seems to be the suitable field type. However, it doesn't have the pagination or search feature. To do that, I think you need to write a custom code using a filter library like ListJS (there are probably more libraries).You can hook to
rwmb_enqueue_scriptsaction to enqueue your JS like this:add_action( 'rwmb_enqueue_scripts', function() { wp_enqueue_style( 'listjs', 'URL here' ); wp_enqueue_script( 'listjs', 'URL here' ); wp_enqueue_script( 'your-js', 'URL here' ); } );And in your JS file, you can write the JS that does the filtering or searching.
Anh Tran
KeymasterHi,
Looks like you're using cloneable groups. For each value of a group, please check the existence of sub-fields, like this:
$title = isset( $item_item_item['title'] ) ? $item_item_item['title'] : ''; echo $title;Anh Tran
KeymasterHey Infolu,
This can be achieve by using Compound Statements in Conditional Logic.
https://docs.metabox.io/extensions/meta-box-conditional-logic/#compound-statementsHere is my example, the field Address will visible when Full Name or Email has filled.
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { $meta_boxes[] = array( 'id' => 'personal', 'title' => 'Personal Information', 'post_types' => 'post', 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => 'Full Name', 'desc' => 'Full name', 'id' => 'name', 'type' => 'text', ), array( 'name' => 'Email', 'desc' => 'Email Address', 'id' => 'email', 'type' => 'email', ), array( 'name' => 'Address', 'desc' => 'Address', 'id' => 'Address', 'type' => 'text', 'visible' => [ 'when' => [ ['name', '!=', ''], ['email', '!=', ''] ], 'relation' => 'or' ] ) ) ); return $meta_boxes; } ); -
AuthorPosts