Skip Navigation

[Resolved] Put a type field's URL into a link

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

Problem:
How to create a link with caption using Types field.

Solution:
Using HTML anchor tag you can careate a HTML link using Types URL field.

For example:

<a href="[types field='affiliate-link' output='raw'][/types]" target="new">TAKE THIS COURSE</a>

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

This support ticket is created 8 years, 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by gaborG 8 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#372751

I'm sure this has been discussed before but I didn't find the solution.

I have a URL field in a custom post type that points to another website.
I want to make a <div> in the layout that acts as a button and points to this URL (a different URL in every instance of the custom post type).

When I tried to do it, I got back very disturbing CSS and the link didn't work either... What's the solution?

#372784

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Normally, you can bind your custom field with anchor-tag.

For example,

<a href="YOUR-CUSTOM-FIELD" target="_blank"> what ever content </a>

To style your view with custom CSS please refer to the following link that may help you:
=> https://toolset.com/documentation/user-guides/adding-custom-css-views/

#373037

Yes, that's exactly what doesn't work.

<a href="[types field="course-link"][/types]" target="_blank">TAKE THIS COURSE</a></div>

The result is this:
hidden link

#373097

I see why was the result a wacky link. I fixed the " and '. However, it keeps linking to the page itself (the same page where the button is on), instead of to the URL that is given in the course-link field. Why is that?

#373417

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please share your problem URL where I can see your issue firsthand.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#373769

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now:

I've modified your code in visual editor cell as follows:

<a href="[types field='affiliate-link' output='raw'][/types]" target="new">TAKE THIS COURSE</a>

Now, you can open the link in new tab. I hope this solution will help you to resolve your issue.

#374063

Thank you, now it works.

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