Skip Navigation

[Resolved] How to add links to the custom fields..

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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 1 reply, has 2 voices.

Last updated by Nigel 6 years, 10 months ago.

Assisted by: Nigel.

Author
Posts
#621389

I am trying to add links to the custom fields so if something is clicked it eill pull the archives for that custom feild

example below...

Country: {!{types field='name-of-country'}!}{!{/types}!}  Starting Point:  {!{types field='starting-point'}!}{!{/types}!} Duration: {!{types field='duration'}!}{!{/types}!} Lifestyle: {!{types field='type-or-trail'}!}{!{/types}!}

Thanks

#622085

Nigel
Supporter

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

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

Hi Wayne

Firstly, please note that you are posting in the Community Forum for users of the free Types plugin. As a Toolset customer you can and should post in the Technical Support forum which we prioritise and where you should receive speedier service.

The URL for archives typically looks like site.com/project/ (for a custom post type with a slug of project, for example).

You can construct links using Types custom fields as long as they output the post slug, like so:

<a href="[wpv-bloginfo show='url']/[types field='country-slug'][/types]/">Visit [types field='country-slug'][/types] archive</a>

That will only work for fields that output URL-friendly slugs (e.g. 'united-kingdom') and not plain text (e.g. "United Kingdom").

You could have separate fields on your posts for human-friendly and URL-friendly formats, or you could register a custom shortcode to output such fields where you set an attribute to specify is a string should be converted to a URL-friendly format (e.g. using the WP function sanitize_title to generate the URL-friendly version: https://codex.wordpress.org/Function_Reference/sanitize_title).

You can read about registering your own shortcodes here: https://developer.wordpress.org/plugins/shortcodes/

(Note that the examples you give are shortcodes in a proprietary format using curly braces instead of square brackets for use in page builder modules.)

The forum ‘Types Community Support’ is closed to new topics and replies.