Hi
I tried but without success to retrieve some repeatable data from a CPT included in a view...
So, my CPT is a "Property" which has a repeatable field "Lots" that describe the content of this property (for example 3 apartments and 4 houses)
In this page I've created a view to list the properties available in a city:
hidden link
I'd like to display below the property name (for example here "Falcon Lodge")
"2 chalets, 44 apartments "
Could you help me to achieve that ?
Thanks a lot.
Best regards,
Fabrice
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
As I understand you are talking here about the repeating field group - not repeating field.
If you want to display the items belongs to repeating field group - you will have to create a view. Please check the following doc with step by step details.
=> https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/#displaying-repeatable-field-groups
Please let me know if you require further assistance.
Hi Minesh,
Thanks for your help ! I succeeded to retrieve the data.
A last question... if you go the this page hidden link you can see 2 lots of items.
there can be 3 sometimes. So I'd like to display a comma between the firsts items and a "and" just before the last in order to have:
"2 houses, 4 appartments and 2 chalets"
How can I do that ?
I also need to text the quantity variable to see if the system add a "s" at the end of each lots if they are >1...
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
You can use the view's shortcode [wpv-item] to check the index
=> https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-item
For example:
<wpv-loop>
[wpv-item index=1]
[your-shortcode],
[wpv-item index=other]
[your-shortcode]
[wpv-item index=last]
and [your-shortcode]
</wpv-loop>
You can adjust the [wpv-item] shortocde with index as required.
You can use the [wpv-conditional] shortcode to display the conditional output.
=> https://toolset.com/documentation/legacy-features/views-plugin/#conditional-output-in-views
My issue is resolved now. Thank you!