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