Skip Navigation

[Resolved] Add custom title for each file i upload and display the title and link to file

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by dimitarK 9 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#265059
file-types.png
types-file.png

I am trying to:
Add 4 file fields in post page but i need to add custom title which client must fill and display this title with link to the file
I visited this URL:
hidden link
I expected to see:
Exactly this but i need to have custom title for each PDF 1,PDF 2 ( i need to add option for custom title for each PDF and display this with link to the PDF file i uploaded. )
Instead, I got:

#265215

I suggest you create a child post for the PDF files, store the custom PDF title and file URL in the child post type.

More help:
Creating Groups of Repeating Fields
https://toolset.com/documentation/user-guides/creating-groups-of-repeating-fields-using-fields-tables/

#265262

So actually i need these option.
The client go to post start type the title for the post.
After that if any content.
They need to upload different PDF to each post and we need this PDF to have custom title.
The title for each PDF will be added from the client.
Is that possible or no? I want all to be in one place.
When the client add the post he should have this option to upload PDF and add custom title for this pdf.

#265512

Yes, it is possible within Types+ Views, what you need is a repeating fields group
See below test site:
hidden link
user/pass: xgren/111111

In above demo site, When you edit the parent document post, in the "Fields table" section, you will be able to add multiple child PDF posts, set the file title and upload the file for each PDF post,

More help:
Creating Groups of Repeating Fields
https://toolset.com/documentation/user-guides/creating-groups-of-repeating-fields-using-fields-tables/

To display the child posts in the parent post, please check the document:
https://toolset.com/documentation/user-guides/display-fields-table-content-using-views-or-the-types-api/

#266546

Hi Again i have some updates.
Now i am abble to add title to each file
see here hidden link
I got message "Repeating fields should not be used in child posts. Types will update all field values."
When i try to add new Post - in the Fields Table i'm getting this:
"You will be able to manage child posts after saving this post."
If i save draft i am able to add new PDFs but still got this message "Repeating fields should not be used in child posts. Types will update all field values."
Also i Add this code in the Template where i want to display this PDF files

<?php
$child_posts = types_child_posts('addpdf');
foreach ($child_posts as $child_post) {
  echo '<li>';
  echo $child_post->post_title;
  echo '</li>';
  echo $child_post->fields['description'];
}
?>

I am able to view the title see the screen:
hidden link
But how can i do this title link to the PDF file opened in new window.

#266556

1) Q: "You will be able to manage child posts after saving this post."
As I mentioned above, you will need setup the PDF field as a single instance field

2) Q: But how can i do this title link to the PDF file opened in new window.
What is the slug you set for the PDF file field? for example, it's slug is "pdf".
You can simply create a HTML a tag for it, like this:

echo '<a href="' . $child_post->fields['pdf'] .'" target="_blank">' . $child_post->post_title . '</a>';
#266653

I have sucess with the PDFs but still have this message " You will be able to manage child posts after saving this post."
I was create a video - hidden link
Let me know where i'm wrong thank you

#266865

Yes, it is expected result, as the message you mentioned above, you will be able to add child posts in the field table section after you saving the parent post, Types need to setup the parent post ID.

#266941

Thanks for you support

The forum ‘Types Community Support’ is closed to new topics and replies.

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