Skip Navigation

[Resolved] Can’t find the shortcode to embed a dynamic PDF document.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 1 voice.

Last updated by albaP-2 6 days, 5 hours ago.

Assisted by: Minesh.

Author
Posts
#2861874
Captura de pantalla 2026-05-21 141318.png

Hello. I'm working on an online archive, for which I created a custom post type and a custom field for "Files", where I uploaded a PDF for each archive item. The thing is I can't find the appropriate shortcode or block to embed it dynamically.

I have tried the Block Editor's block "File" and customising the URL by manually replacing the source with the code "[types field='item-doc]" but that renders an "a href" block and not the raw URL text.

I have not found the appropriate documentation to make my own shortcodes. I'd be interested in that, as I might face similar issues building other parts of my archive. Also I'm not too good at code yet.

In the end what I'm trying to do is to embed the PDFs dynamically. If there's an easier way I'd love to know it! But so far none of the Toolset blocks I've tried seem to be working for that purpose.

I'm using the Twenty Twenty-Five theme.

Thank you!!

Edit: This is the closest I got, but it displays what appears in the attached image

<div class="wp-block-file"><object class="wp-block-file__embed" data="[types field="item-doc" ouput="raw"][/types]" type="application/pdf" style="width:100%;height:600px" aria-label="MOB-6-63_Diccionario de Flores_Elan"></object></div>
#2861903

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

To make the browser download a file when its link is clicked, the 'download' attribute can be used:
- hidden link

What if you try to add the shortcode block and add the following content to it.

For example, suppose you have a file type field with slug 'post-file' and its download link will look like this:

<em><u>hidden link</u></em>

In your case:

<em><u>hidden link</u></em>

Regarding the how to add or build custom shortcode - please check the following Doc:
=> https://toolset.com/documentation/programmer-reference/adding-custom-code/how-to-create-a-custom-shortcode/

#2861971

EDIT: I had a typo in my code!! I was writing "ouput". This shortcode is working just fine:

[types field='item-doc' output='raw'][/types]

Thank you!!

---
Hi Minesh!

I am actually trying to embed the PDF dynamically, not download it. I have found that I can push a custom link into WordPress' native PDF embedder, only thing is I still haven't found the correct shortcode to call for the raw url.

The code I'm actually using is this:

[types field='item-doc' output='raw'][/types]

("item-doc" being the file field I'm summoning)

and it's displaying an "a href" element with the link and the link as text:

<em><u>hidden link</u></em>

I'm looking for a shortcode to display just the URL, so I can insert it into WordPress' native PDF embedder. Like this:

<em><u>hidden link</u></em>
#2861972

Thank you!!