Skip Navigation

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

This thread is resolved. Here is a description of the problem and solution.

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 3 years, 8 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 – 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)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Francisco Ramón Molina Busquiel 3 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#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: English (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: English (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.