Skip Navigation

[Résolu] How can I assign in a view the id of the post inside a shortcode?

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The issue here is that the user wanted to know how to get the current post's ID with a shortcode.

Solution:

This can be done by using the shortcode below.
[wpv-post-id]

This support ticket is created Il y a 3 années et 7 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Marqué : 

This topic contains 4 réponses, has 2 voix.

Last updated by Francisco Ramón Molina Busquiel Il y a 3 années et 7 mois.

Assisted by: Shane.

Auteur
Publications
#1727027

Hi,

Inside a shortcode included in a block of a Toolset view how can I put the id of the current post?
For example, in the following shortcode:
[sdm_download id="4868" fancy="0"]
how can I make the number 4868 the id of the current post?
Something like:
[sdm_download id="{id_post}" fancy="0"]

Thanks for your help.
Regards,
Jose A.

#1727521

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jose,

This will only work if your shortcode accepts a shortcode as a parameter. If it does you can try this.
[sdm_download id="[wpv-post-id]" fancy="0"]

Thanks,
Shane

#1727641

Hi Shane,

It has worked perfectly. 🙂

Have you been able to see the problem of the other ticket I have?
https://toolset.com/forums/topic/i-cant-assign-a-custom-field-to-a-toolset-block-image/

Thanks for your help.

Regards,
Jose A.

#1728579

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jose,

Happy I was able to assist you with this one.

I'm currently having a look at your other ticket so you can mark this one as resolved.

Thanks,
Shane

#1728659

My issue is resolved now. Thank you!

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