Skip Navigation

[Resolved] Linking a custom field in a view to its post

This thread is resolved. Here is a description of the problem and solution.

Problem:
The customer asked how to create a post link, that uses text value from one of the custom fields.

Solution:
Shared an example code for a custom link that uses Types fields API shortcode.

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/

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 4 replies, has 2 voices.

Last updated by Del_W5502 1 year, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2370275

Tell us what you are trying to do?
I've created a view which uses a custom field which was added to the view using a "Fields and Text" block. ( I could use a "Single Field" block if that is better.) I want to be able to link that field to its post. Normally I could use use the post title or a button to link to the post but in this case I'd like to link the custom field. In the old views plugin I think you had to edit the html but I'm not sure how to add the link using the newer way of doing things.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2370535

Waqar
Supporter

Languages: English (English )

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

Hi,

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

To suggest the best way to achieve this, I'll need to see how this custom field is set up in the admin area.

Can you please share temporary admin login details, along with the link to an example page where you'd like to show this custom field value as a link?

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2373293

I've created a view by adding a view block to a page. I'm trying to link a "Fields and Text" field to it's post.

I ended up using a button. I selected the field I wanted for the button text and then the post url as the url. I then styled it so it doesn't look like a button by removing the background color but I'd still like to know how to link a "Fields and Text" field or a "Single Field".

I'd prefer to hold off on sharing login details but if you could share how this could be accomplished I'd appreciate it. Give me the general steps or provide a link to documentation.

Thanks

#2373911

Waqar
Supporter

Languages: English (English )

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

Thanks for writing back.

I'll assume, you have some text coming from a custom field in a view and you'd like to make this text a link to the relevant post.

If that is correct, you can create this link manually, using shortcodes in the "Fields and Text" block (in HTML mode).

For example:


<a href="[wpv-post-url]">[types field='custom-field-slug'][/types]</a>

Note: You'll replace 'custom-field-slug' with your actual custom field's slug.

For the available Toolset shortcodes reference, here are some useful links:
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.

#2374213

My issue is resolved now. Thank you!

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