Forum Replies Created
-
AuthorPosts
-
January 31, 2018 at 2:13 PM in reply to: ✅MB Relationships - Using each_connected multiple times #8410
Anh Tran
KeymasterNo problem. Here is the code for registering relationships:
add_action( 'mb_relationships_init', function () { MB_Relationships_API::register( array( 'id' => 'posts_to_pages', 'from' => 'post', 'to' => 'page', ) ); MB_Relationships_API::register( array( 'id' => 'posts_to_posts', 'from' => 'post', 'to' => 'post', ) ); } );And here is the code to fetch connections (in
index.phpfile):global $wp_query; MB_Relationships_API::each_connected( array( 'id' => 'posts_to_pages', 'from' => $wp_query->posts, 'property' => 'connected_pages', ) ); MB_Relationships_API::each_connected( array( 'id' => 'posts_to_posts', 'to' => $wp_query->posts, 'property' => 'connected_posts', ) );Here is the code in the
content.phpfile:foreach ( $post->connected_pages as $post ) : setup_postdata( $post ); the_title(); endforeach; wp_reset_postdata(); echo '<hr>'; foreach ( $post->connected_posts as $post ) : setup_postdata( $post ); the_title(); endforeach; wp_reset_postdata();Anh Tran
KeymasterHi, the problem is your post field ID. On the editing screen, the
#postis used for the post form, so you can't use IDpost. You need to change the ID of the post field.Then, you can hide the group if the field is null with this condition:
'hidden' => array( 'post2', '=', '' ), // post2 is post field ID.PS: Please renew your license to get updates of extensions and support.
Anh Tran
KeymasterWe’ve just realized this problem and we’re working this.
PS: It's fixed in the version 1.2.2. Please update.
January 29, 2018 at 11:15 AM in reply to: ✅How to add a custom id to the "rwmb-meta-box" wrapper #8383Anh Tran
KeymasterHi UG,
1. If that's the case, then you can use the
idautomatically created by WordPress. Each meta box will have a unique ID the same as the ID settings. See this screenshot:https://imgur.elightup.com/yP1KjMq.png
2. I've seen the issues with the code. No need screenshot anymore. I will check and fix it asap.
3. I've checked and seen the fields appear before
.edit-tag-actions. Here is how it appears on my side:https://imgur.elightup.com/M7XcDOv.png
PS: To upload the screenshot, you can use this app: https://getsharex.com/. It auto uploads images to imgur.com after taking screenshots. Then just paste the image URL here.
Anh Tran
KeymasterAnh Tran
KeymasterHi, your code seems to correct. When specify
limitit returns an array of single image. So you might want to do this:$images = rwmb_meta( 'field_id', array( 'object_type' => 'setting', 'size' => 'thumbnail', 'limit' => 1, ), 'options_name' ); $image = reset( $images ); echo $image['url'];Anh Tran
KeymasterPlease send me via email. Thanks.
Anh Tran
KeymasterHi, this is a good idea. I planned to worked with admin columns. I will make a not on that.
January 29, 2018 at 8:46 AM in reply to: ✅MB Relationships - Using each_connected multiple times #8375Anh Tran
KeymasterHello,
I've just tested again with a similar code and here is my result:
Can you check your code again please?
Anh Tran
KeymasterHi,
The MB Builder hasn't supported the MB Term Meta yet. But you can get over it with "Custom Attributes" for meta box. Switch to "Settings" tab and set a custom attribute "taxonomies" and enter your taxonomy slug into the input, like in this screenshot:
https://imgur.elightup.com/ZwsLeKM.png
We'll update the plugin to make it easier for selecting taxonomies in the next version.
Anh Tran
KeymasterHi, I've just added the CRUD API to the extension. I will release the new version soon.
PS: Just released new version 1.1.0. Please see this documentation for usage.
Anh Tran
KeymasterMy bad. I thought it's possible for "from" side only. I will work on that now and update the plugin asap.
PS: It's done. I will update the extension soon.
PS2: Just released version 1.1.0. Please update.
Anh Tran
KeymasterIt should be able. I've just received the bug report and will work on that now.
PS: I'm done. Will update the extension tomorrow.
Anh Tran
KeymasterHi, I've just tested with the 2017 theme and it works. Probably there's some CSS conflicts with your theme. If that's the problem, please add some CSS to adjust it.
January 26, 2018 at 9:49 AM in reply to: ✅How to add a custom id to the "rwmb-meta-box" wrapper #8348Anh Tran
KeymasterHi UG,
Thanks for your questions.
1. Currently, the wrapper div is not extendable. Can you tell me why do you need an ID?
2. Does the custom field have the
namesetting? Can you post a screenshot? It suppose to have the same table layout as other WordPress fields for terms.3. That's right. It's the only place that WordPress provides hook to show other custom fields. We can't change it.
-
AuthorPosts