Skip Navigation

[Resolved] Attachments and toolset ?

This support ticket is created 4 years, 11 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by romanB-3 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1528767

Hi,
If I understand it well, WP uses an "attachment" link between media files from media library, and posts.
It seems by default, only one attachment can be linked to a post, but I would need several.
I first created a new custom files field allowing several entries, but I then discovered a simple hook may allow several attachments, for instance by using this plugin : hidden link
As long as it's possible, I'd rather use the default WP core, and not adding fields that would then be redundant.
1- Do I understand well the "attachment" defaut system ?
2- Do you recommend using the "multiple attachments" hook allowed by the plugin ? Or is it a better way to do this ?
3- How should I manage in Toolset in order to display those attachments as a list under a post ?
Thank you.

#1529379

1- Do I understand well the "attachment" defaut system ?
It is possible to add more than one attachment to any post. Use the Media library to insert multiple images in a post body and each of those images becomes an "attachment". I don't think you understand this well.

2- Do you recommend using the "multiple attachments" hook allowed by the plugin ? Or is it a better way to do this ?
I don't understand how this relates to Toolset. Can you explain?

3- How should I manage in Toolset in order to display those attachments as a list under a post ?
Toolset Views can only loop over public post types, and attachments are not a public post type. So Views cannot loop over attachments. Similarly, Types cannot add custom fields to Attachments. So the integration between attachments and Toolset is very limited. You would have to use custom code to display a list of attachments associated with a post. https://developer.wordpress.org/reference/functions/get_attached_media/

#1538703

OK thank you. In deed if attachments can't be used in the views loop it's useless and I will need to create a custom field for media files. Thank you.