Skip Navigation

[Resolved] Shortcode not showing Link title correctly

This support ticket is created 4 years, 11 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
- 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)

This topic contains 5 replies, has 2 voices.

Last updated by geoffD 4 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1388691

Hello

I have a view on a page called 'Who Inherits my Estate?' that is displaying a list of CPT 'PEOPLE' and I'm trying to add an anchor link to each 'PERSON' that takes you to their edit page... The link text is the post title which is the PERSON's name e.g. Luke, Sam, Jenny etc. The link works fine and redirects you correctly to the edit page but the link text using the shortcode [wpv-post-title] is showing the page title(i.e. Who Inherits my Estate?) rather than the CPT PERSON name... If I take out the [toolset-edit-post-link layout_slug="people-add-beneficiary"] link then the shortcode [wpv-post-title] works fine displaying the PERSON's name (but obviously doesn't link to anything..

Many thanks for your help

Best wishes

Geoff

#1388769

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-11-21 at 13.52.24.png

Hi Geoff

Can you not use the placeholder %%POST_TITLE%% in the link text?

When you use the Toolset Forms button to insert the edit link it comes pre-populated with that placeholder.

See the screenshot. That will output the title of the current post, i.e. the current person in the loop.

#1388849

That worked great...!My issue is resolved now. Thank you!

#1389061

Aaaah sorry to open this thread again Nigel.....

I'm having exactly the same problem with using post fields and edit post links within a view loop.

In this example below, if I use [types field='inheritance-percentage' format='FIELD_VALUE'][/types] on it's own I get the correct output, but if I wrap it in a edit post link ([toolset-edit-post-link layout_slug="add-percentage-split"]) It returns nothing at all!... and the %%POST_TITLE%% obviously only works for the title of the post in the loop and not the other fields...Here is the problem..

[toolset-edit-post-link layout_slug="add-percentage-split"]
[types field='inheritance-percentage' format='FIELD_VALUE'][/types]
[/toolset-edit-post-link]

Your help is massively appreciated..

Best regards

Geoff

#1389225

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Geoff

The context of the current item in the loop is being lost inside the edit link shortcode.

As well as the %%POST_TITLE%% placeholder, you have available the %%POST_ID%% placeholder.

So you can add an id attribute to your shortcodes to enforce the correct context.

In your example this would be:

[toolset-edit-post-link layout_slug="add-percentage-split"]
[types field='inheritance-percentage' format='FIELD_VALUE' id='%%POST_ID%%'][/types]
[/toolset-edit-post-link]
#1389323

My issue is resolved now. Thank you!