Skip Navigation

[Resolved] Make view titles clickable as external link

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

Problem: I have a View of posts. In the Loop of the View, I have placed a custom field shortcode to display the "header" field as text. There is a URL custom field on the same post, and I would like to make the header field text a clickable link, pointing to the URL custom field.

Solution: Create a link tag manually using HTML and Types field shortcodes:

<h4><b><a href="[types field='website' output='raw'][/types]">[types field='header'][/types]</a></b></h4>

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/

This support ticket is created 5 years, 9 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by catrionaD 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1196114

I'm trying to create a directory of third party services.

I have set up a few filters and search box. When results are displayed, I would like the webpage link to be embedded in the post title text. This way a user can click the title and be taken to the third party service webpage.

The thirdparty service webpage is included in the custom form.

The link to my site is hidden link

Is there a way this can be done?

#1196136

As I was saying in chat, the loop seems to indicate the "header" field is used to display the title, and you're saying that the header field is simple text. So I'm not clear how the formatting is applied to this field, and I'm confused by post title vs. header. If header is a WYSIWYG field, then you must add the link inside the WYSIWYG editor. If it's plain text, then I must not have all the code for the loop template based on what I can see on your site.

#1196139

Sorry that was unclear!

The Header Field is used to display the title, that is correct.

In the Custom Fields, the Header Field is set to a single line input, not URL. When I add a new field I set what the content type is. This is what I meant by the Header Field is a text field.

The formatting I've used for displaying the Header Field is under Edit View : Loop Item In Directory Search :
<h4><b>[types field="header"][/types]</b></h4>

#1196267

"If header is a WYSIWYG field, then you must add the link inside the WYSIWYG editor. If it's plain text, then I must not have all the code for the loop template based on what I can see on your site."

Sorry do you know whether it's a WYSIWYG field, and where to put the code?

#1196327

The formatting I've used for displaying the Header Field is under Edit View : Loop Item In Directory Search
Okay thanks, that makes sense. To create a link with the header text, you can replace the entire h4 tag with this:

<h4><b><a href="[types field='website' output='raw'][/types]">[types field='header'][/types]</a></b></h4>

That will create a link to the "website" field URL, displaying the "header" field text. It will probably turn the title text link blue, because links are formatted to be blue on your site. Custom CSS may be required to override that.

Sorry do you know whether it's a WYSIWYG field, and where to put the code?
If it's a single line field, then it's not a WYSIWYG field because they are different types of custom fields. WYSIWYG stands for "What you see is what you get", and implies that you can apply styles right in the editor. I wouldn't be concerned in this case because it sounds like "header" is just a single line text field, not a WYSIWYG.

#1196611

My issue is resolved now. Thank you!