Skip Navigation

[Resolved] retrieves repeatable field from an CPT

This support ticket is created 2 years, 12 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by fabriceS 2 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#2127519

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

#2127765

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.

#2128255

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...

#2129395

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

#2129595

My issue is resolved now. Thank you!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.