Skip Navigation

[Resolved] Dynamic Link Shortcode

This support ticket is created 2 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Waqar 2 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2049609
aaa screen.png

Hi there,

Do you know, by chance, if there is a short code that can reproduce this?
See pic attached.

We wish to create an Kadence element, this for all our holiday home custom post types, this one template for all.
The image shows this set up correctly on the template we have created, however we can see no way of doing this is we design something away from the template.

In short, a Kadence 'element' is created away fro the template and then assigned to show on all.

Worth an ask 🙂

#2049977

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Pete,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and the dynamic source dropdown option is available, only when working within the Gutenberg editor's environment.

For any other environment or editor, you can use the Types Fields API and Toolset Views shortcodes, to get the required data:
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2050273

Hi there Waqar,

Thank you, I did find this page yesterday however having never really used shortcodes before don't even know where to start.
This page is full of, what looks like, every conceivable code for every scenario.

Where on earth do I start?

#2050567

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

Simply put, the shortcodes are placeholder text/strings, which expand into more meaningful data.

You'll note that in the left sidebar of the 'Views Shortcodes' page, the list of shortcodes is grouped by their usage.

For example, under the 'Displaying data' heading, you'll find shortcodes that can be used to show data from the current single post/page, either on the single post/page or in the loop of the view.

If you'd like to display the current post/page ID, you can use '[wpv-post-id]' shortcode. And for the title, you'll use '[wpv-post-title]' and so on.

Similarly, you can search for the relevant shortcode and its attributes, based on what data or information you need.

If you face any difficulty in finding the right shortcode for a specific requirement or scenario, you're welcome to write to us anytime.

#2050601

I kind of get 'some' of what you are saying.

Ok trying to use this, I see no shortcode for a dynamic link, this from a custom field called 'off site link'.

Is this possible? Does this kind of code even exist?

#2052727

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

It is important to remember, that when using the shortcodes, they'll not generate the complete HTML code for you, like the blocks.

They'll only provide you the relevant dynamic piece of information, which you can use in your static HTML code, manually.

Here is a quick example. Suppose, I have a URL type custom field with slug 'off-site-link' and I want to show a link using that field's URL, that opens in a new browser tab. And for the link's title, I'd like to use the current post's title.

The HTML code for this link, with dynamic data from shortcodes, would be:


<a href="[wpv-post-field name='wpcf-off-site-link']" target="_blank">[wpv-post-title]</a>

Please note how I've used 'wpv-post-field' shortcode, to get the URL from the custom field and the 'wpv-post-title' shortcode, to get the post's title.

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-field
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-title

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