Skip Navigation

[Résolu] How to output the post ID inside a toolset post edit link

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

Problem:
Client is adding links to edit posts using the toolset-edit-post-link shortcode and wants to include the post ID of the post to be edited in the link text.

Solution:
Use the placeholder %%POST_ID%%.

See the screenshot in the answer below.

0% of people find this useful.

This support ticket is created Il y a 6 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Marqué : 

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par julieP Il y a 6 années et 5 mois.

Assisté par: Nigel.

Auteur
Publications
#913322

I have a View on a page (ID=25) that queries a post type and contains a post edit link shortcode for a content template which contains the edit post form. I'd like to use the returned post's ID (=34) as the text for the link and have tried it like this:-

[toolset-edit-post-link content_template_slug="content-template-slug"][wpv-post-id][/toolset-edit-post-link]

but this returns 25 (the ID of the page containing the View).

If I place [wpv-post-id] outside the post edit link shortcode like this:-

[toolset-edit-post-link content_template_slug="content-template-slug"][/toolset-edit-post-link][wpv-post-id]

this returns 34 (which is correct).

When I insert the [wp-post-id] shortcode, I'm selecting The current post being displayed either directly or in a View loop from the options.

How do I achieve the desired output please?

#913354

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Screen Shot 2018-06-14 at 09.18.04.png

Hi Julie

It looks like the context for the post object changes inside the toolset-edit-post-link shortcode, which might not be possible to change.

Before thinking of any more complex workarounds, can you not just use the %%POST_ID%% placeholder?

#914560

Ha! I hadn't thought of that, thank you!!