Skip Navigation

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

This support ticket is created Il y a 4 années et 5 mois. 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
- 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 réponse, has 2 voix.

Last updated by Waqar Il y a 4 années et 5 mois.

Assisted by: Waqar.

Auteur
Publications
#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: Anglais (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.