Add number to my relationships
Support › MB Relationships › Add number to my relationshipsResolved
- This topic has 4 replies, 3 voices, and was last updated 2 years, 4 months ago by
[email protected].
-
AuthorPosts
-
April 22, 2021 at 9:16 PM #27521
[email protected]
ParticipantHello,
I took the extension a little while ago, knowing ACF well, I would like to create a site (test) to store recipes.
I have created my two CPTs:
- Ingredients
- RecipesI created a relationship between these two CPT and I would like, when I choose my different ingredients, to add a quantity to them (and then display everything directly)
I use as extension :
- Elementor
- Elementor Pro
- MB Blocks
- MB Custom Post Types & Custom Taxonomies
- MB Frontend Submission
- MB Relationships
- Meta Box
- Meta Box - Elementor Integrator
- MB Builder
- MB Conditional Logic
So I haven't coded anything if I have to, no worries I'll go through it!
Also while I'm at it for each ingredient I put an image in front of them, how can I get this information in my page template elementor ?
Visually I would like to put : image ingredient - name ingredient - quantityThank you very much!
April 23, 2021 at 10:13 AM #27553Long Nguyen
ModeratorHi,
It's not possible to add a field value to a connection post by using MB Relationships. But there is a field type
postwhich works similar to Relationships. Here are some guides for you:- Create a cloneable group
- Create subfields: post, image, text, number
Assign the meta box to the CPT Recipes so each cloneable group you can select a post Ingredient, add images, text (name), number (quantity).
Get more details on the documentation
https://docs.metabox.io/extensions/meta-box-group/
https://docs.metabox.io/fields/post/April 23, 2021 at 3:48 PM #27566[email protected]
ParticipantThank you for your reply!
I have a problem with this because if I want to make something clean, it means that the person has to manually retrieve the image of the ingredients each time...
I'm looking at both your documentations thanks to you! 🙂
June 12, 2023 at 9:06 PM #42165[email protected]
ParticipantHi Long Nguyen,
Apologies to resurrect this post, but this was exactly the information I needed. If I wanted to display this on the single post template, how would I do this? It gives me the following PHP, but it doesn't seem to do anything.
<?php $groups = rwmb_meta( 'plots' ); foreach ( $groups as $group ) { // Field plots: $post_id = $group[ 'plots' ] ?? ''; ?> <p>Selected post ID: <?= $post_id ?></p> <?php // Field quantity: echo $group[ 'quantity' ] ?? ''; } ?>Thanks again
Dan
June 12, 2023 at 10:13 PM #42170[email protected]
ParticipantDon't worry I sorted it, my group had the same id as my post. Thanks anyway 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.