Skip Navigation

[Resolved] I d'like to display an icon (or image) based on document file format pdf or xls

This support ticket is created 4 years, 4 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
- 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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 4 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#1403255

I have a custom post type where is a repeatable file field, if the file attached is a pdf in output view I d'like to show the pdf icon, when the file is a xlsx I' dl'ke to show the xlsx icon

I know the conditional output but I don't how to manage the file format

now i set the view like this and all works fine but obviously only the pdf icon are shown

<img src="hidden link" width="24" height="29" class="alignleft size-medium" /><a href="[types field='pdf' output='raw'][/types]" target="_blank" rel="noopener noreferrer"><div class="download">[wpv-post-title]</div></a><br>

this is one of the output pages hidden link

many thanks in advance

#1404145

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

To use conditional output, based on the file's type/extension, you'll need a custom shortcode, that can return the file's extension ( i.e. pdf, xls etc ), from its URL.

This reply has a good example of such custom shortcode and its usage in the conditional output:
https://toolset.com/forums/topic/file-extension-in-conditional/#post-578332

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

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