Hi,
I have created a CPT with a group of custom post fields. On of the fields is "URLs" and can be added mutiple tomes to the CPT. Nw I tried to create a view integrated in a template for the CPT. Unfortunately all "URLs" of all CPT posts doe show up in each of the single post of the CPT.
What do I wrong? How can I limit the URLs to the one from the CPT post?
I scanned the documentation but did not find my case....
Kind regards, Martin
I saw tat not a view is needed but that I can select the CPF in the template itself. But here I get a comma-seperated list.Hwo can i make
Hi, I just found this:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/
But the section with the fields below of the post types is not shown anymore! Video seems to show an older Toolset-Version, right? So there must be another way.
So, now I know what I stumble about! Sorry for this updated question... what I found out:
There are repeatable field groups (Video) and e. g. single line where you can check that multiple instances can get filled in.
I learned the earlier can get designed via a view and yes, the group show up now after I found this „other“ field type.
The later gets displayed in a template just by adding the field where multiple instances can get separated by a comma et. al.
So now my questions are:
1: can the later get styled different just by a separator? More like in a view with a loop?
2: or is this possible and I habe to choose before how to add a field with multiple instances if I later want to just list it separated by a separator or if I want to style it more complex?
3. what is the difference between these two options to add a field with multiple instances?
Kind regards, Martin
1: can the later get styled different just by a separator? More like in a view with a loop?
No, Views is not designed to loop over repeating custom fields like this. If you want a more complex template for each item, the repeatable field group (RFG) approach is best. Or, you could use custom PHP code to write your own loop and template.
2: or is this possible and I habe to choose before how to add a field with multiple instances if I later want to just list it separated by a separator or if I want to style it more complex?
Yes, it's best to decide in advance how you want to display the list of instances. If you want a more complex template for each item in the list, a RFG is best. Otherwise, you need custom code.
3. what is the difference between these two options to add a field with multiple instances?
A repeatable field group (RFG) works more like a custom post type, and supports more than one custom field in each instance. For example, in an RFG you could include a URL field and two text fields, so you can create a custom link with a URL, custom text, and an "alt" attribute like this:
<a href="[types field='url' output='raw'][/types]" alt="[types field='alt' output='raw'][/types]">[types field='link-text' output='raw'][/types]</a>
A field that allows multiple instances does not allow more than one custom field per instance, so you could not include custom text to display in the link or a custom "alt" attribute. Each URL could not be linked to other custom field information effectively.
A RFG is also easy to display with Views, but a repeating image field is not.
My issue is resolved now. Thank you!