Skip Navigation

[Resolved] PDF Permalink

This support ticket is created 4 years, 10 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 1 reply, has 2 voices.

Last updated by Beda 4 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#1464501
PDF-Upload-Permalink.png

Hello,

We have a section (custom post type) of our client's website for uploading digital documents (PDFs). I'd like for the permalink to be directed to the PDF URL that has been uploaded

If they do not upload to the site and only provide a URL for the document, then I'd like the permalink to be directed to the URL.

See screenshot for more notes.

Thank you!

#1465533

A File Field of Toolset will, if output on the front end, produce a Link to the PDF that can be clicked to reach the PDF.
However Custom Fields are not redirecting, these cannot be used for this.

Redirects are something managed on HTACCESS Level, where Toolset does not help you as it is a plugin for the design of the website.
You could use some custom code that checks the content of a post when visited, and if it contains an URL to a PDF, then redirect to that, but you'd never be able to actually see the very post, as it would always redirect to the PDF.
Toolset Support cannot help with such code, as it is out of Toolset's scope, but we can recommend contractors listed here https://toolset.com/contractors/ if you need help with the custom code.

Similarly, if there is no PDF but an URL, while you can store, and display that with Toolset, Toolset doesn't provide any means of redirecting to specific URLs as you require.

You can use the Field as the redirect, in your custom code, this is possible because the Toolset Field is just like any other WordPress Custom Field and you can hence either get it with get_post_meta() or as said, with some code that scans the content for such eventual content.
get_post_meta is elaborated here:
https://developer.wordpress.org/reference/functions/get_post_meta/