Skip Navigation

[Resolved] Make a filename inside custom post linkable in view

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

Problem: I would like to use the post title as the text for a link to download a custom field file.

Solution: Use an HTML link tag to wrap the title shortcode in a link, and set the link href value using the custom field's raw output.

<a href="[types field='downloadbestand' output='raw'][/types]" target="_blank" rel="noopener noreferrer">[wpv-post-title]</a>

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#file

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 a.e.a.m.S 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1444487
Schermafbeelding 2020-01-07 om 14.50.10.png

Tell us what you are trying to do? I'm trying to make the title of a custom post clickable so it points directly to the file (to download or view)
The download icon is working, i also want to make the file description clickable with the same name structure as in the example

Is there any documentation that you are following? my code in the view:

<div class="row">
<div class="col-sm-1"> </div>
<div class="col-sm-8">[wpv-post-title]</div>
</div>

I have tried also: <div class="col-sm-8">[types field="downloadbestand" link="true" output="normal"][/types]</div>
but it shows the complete link, i only want the description (post title) to show.

Is there a similar example that we can see?

What is the link to your site? site in development

Hello, it seems like you could wrap the post title shortcode in a link tag, just like the download icon is wrapped in a link tag. The updated code is:

<div class="row">
<div class="col-sm-1"> <a href="[types field='downloadbestand' output='raw'][/types]" target="_blank" rel="noopener noreferrer"><img src="<em><u>hidden link</u></em>" /></a></div>
<div class="col-sm-8"><a href="[types field='downloadbestand' output='raw'][/types]" target="_blank" rel="noopener noreferrer">[wpv-post-title]</a></div>
</div>

Please let me know if this does not solve the problem completely, or if I misunderstood your request.

#1446153

Thanks Christian, it is working!