Skip Navigation

[Resolved] Display name or other data of each repeating field instance

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can we display as example the name of each single file uploaded in a repeating field type?

Solution:
That isn't possible with repeatable Fields.

But there are some workarounds and Custom Code solutions:
https://toolset.com/forums/topic/another-vote-for-showing-filename-only-in-list-of-attached-files/#post-384962

The feature request to allow this is already filed and accepted.

You can also use Post Types as repeatable fields:
https://toolset.com/documentation/user-guides/creating-groups-of-repeating-fields-using-fields-tables/

This support ticket is created 7 years, 1 month 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by theW 7 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#585494
584935-5_1.png
584935-51.png

Hello,
Beda was previously handeling this...
Please assign this ticket to him.

I am trying to:
Have each File Value display with it's own icon and name under it.

Link to a page where the issue can be seen:
The issue is on the Single Custom Posts, which are using a content template with VIEWS.
One sample of the error here:
hidden link
See my screen notes attached.

I expected to see:
5 Icons named and linking to their according file.

Instead, I got:
One Icon with no link and no name.

This is the code in my Views template:

<div class="col-sm-8">
<H3>Files:</H3>

</div>
</div>

Thank you!

This is a repeatable Field, but you did not insert this with any separator or similar.

Please use the GUI to insert the Field.
You will then see an option to add Custom Separators and more.

I changed your code from:

<H3>Files:</H3>
      <a href="[types field='files' output='raw'][/types]" target="_blank"><img src="<em><u>hidden link</u></em>" /></a>

to:

[types field="files" link="true" title="<img src='<em><u>hidden link</u></em>' />" class="css class" style="inline style" separator="<br>"][/types]

As you see I use your Image placeholder as the Link Title and a custom separator (br) to bring them all on a new line.
Each of the Images now links to the file.

Please note (this is VERY important) that WordPress basically forbids using ShortCodes like that.
Now, we added our own magic to make this possible.
But you still need to pay high attention to "" and '' apostrophes.
As you see, I explicitly edited my ShortCode to use "" and '' in every specific place.

The idea is that either you use "" in the outer parts and '' in the inner or the opposite.
You will usually get a hint by the syntax highlighting. Red color means there is something wrong with the syntax and mostly it's due to wrong apostrophes.

#586032

Oh wow!, thanks a lot Beda,
That's a very nifty trick..

I used the

separator="&nbsp;"

Could you also walk me through displaying the names with .extensions under each file?
People would need to know which is which : )

#586183

That isn't possible with repeatable Fields.

But there are some workarounds and Custom Code solutions:
https://toolset.com/forums/topic/another-vote-for-showing-filename-only-in-list-of-attached-files/#post-384962

The feature request to allow this is already filed and accepted.

You can also use Post Types as repeatable fields:
https://toolset.com/documentation/user-guides/creating-groups-of-repeating-fields-using-fields-tables/

But that would require a full refactor of your current setup.

#586846

Thank you for the response Beda, I'll work on implementing those.