Skip Navigation

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

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 4 Jahren, 4 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 4 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Francisco Ramón Molina Busquiel vor 4 Jahren, 4 Monaten.

Assistiert von: Shane.

Author
Artikel
#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

Sprachen: Englisch (English )

Zeitzone: 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

Sprachen: Englisch (English )

Zeitzone: 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!