Forum Replies Created
-
AuthorPosts
-
August 6, 2018 at 2:00 PM in reply to: Edit _Post custom field combine 2 field and add to a field #10892
Anh Tran
KeymasterHi, to combine values of 2 fields when saving, please use this snippet:
add_action( 'rwmb_after_save_post', function( $post_id ) { if ( isset( $_POST['field_1'] ) && isset( $_POST['field_2'] ) ) { $value = $_POST['field_1'] . $_POST['field_2']; update_post_meta( $post_id, 'field_combine', $value ); } } );This snippet combines the values of field_1 and field_2 into field_combine.
To add JS to a meta box, please use this snippet:
add_action( 'rwmb_enqueue_scripts', function() { wp_enqueue_script( 'your-script', 'https://url-to-your-js-file', array( 'jquery' ), '', true ); } ):Anh Tran
KeymasterHi,
The text domain is used for translating the labels when you setup a multilingual website. If your website is not multilingual, you can skip it (by entering any value). Read more about it here.
Anh Tran
KeymasterHi,
Basically, the snippet change the post data before it's saved to the database. In this case, it set the comment status to
closedfor all submitted posts.If you want to make a checkbox for toggling comment status, you can add a checkbox field to the meta box and change the condition to something like this:
// change // if ( 'meta-box-id' == $config['id'] ) { // to if ( 'meta-box-id' == $config['id'] && !empty( $_POST['checkbox_id'] ) ) {August 5, 2018 at 3:09 PM in reply to: Edit _Post custom field combine 2 field and add to a field #10881Anh Tran
KeymasterHello,
Can you please give me more details on combining two fields into one? Do you mean combining the values when saving?
August 5, 2018 at 3:08 PM in reply to: ✅cant add metabox for custom post types with mb builder #10880Anh Tran
KeymasterHi,
This happens with an old date metabox that i created
Can you check the status of those meta boxes? Make sure they're published. You can check in the phpMyAdmin as well.
And i try to import metabox to a new fresh install but i cant. After try to import i am gettiong error like this: Cannot load meta-box-import.
Did you use the export/import functionality from the Builder?
August 5, 2018 at 3:02 PM in reply to: "std" => "" value dissapears on text when text_list or key_value is set to clone #10879Anh Tran
KeymasterI got it. I was looking for the
stdoftext_listfield.By the way, the
stdis used only when the post hasn't been saved. Once it's saved, the values are stored in the DB and will be used next time when page loads.Do you see that happen with new posts?
Anh Tran
KeymasterHi Charlin, I've just fixed the bug. I'll release new version now.
August 3, 2018 at 5:02 PM in reply to: "std" => "" value dissapears on text when text_list or key_value is set to clone #10862Anh Tran
KeymasterHi, I don't see you set
stdattribute for the field?Anh Tran
KeymasterThe easiest way is just set their IDs like:
prefix-textandprefix-radio. Please just don't make something likefield-oneandfield-one-two.I'm working on fixing this bug. Until then, this is the only way to get rid off the bug.
Anh Tran
KeymasterHi,
The problem is the plugin doesn't handle very well the case when a field's ID contains another field's ID. In this case the ID of the input contains the ID of the radio field. The plugin make some guests to find the correct elements. And in this case, it gets the wrong elements 🙁
To prevent this bug, please set the IDs so no one contains another.
Anh Tran
KeymasterHi Jason,
Any reason for using the validation library for custom rules? Because the plugin already has it in the core. And you can just set the rules and messages.
Anh Tran
KeymasterHi Marcel, unfortunately it's not possible for now. I'm thinking a better way to enter options for the fields in the Builder. Probably via a textarea instead of many label/value pairs as it is now.
Update: a new way to enter options is available. Please update the Builder and take a look at this instruction video:
Anh Tran
KeymasterHi Marcel,
Unfortunately, it's not possible at the moment. The builder supports export and import for meta boxes created by the plugin only.
-
AuthorPosts