Skip Navigation

[Resolved] linking a url custom field to image custom field

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

Problem: I would like to use custom fields to store images and urls. On the front-end of the site I would like to display those images as links, and use the url from the custom field as the link destination.

Solution: You could do this with a Repeatable Field Group (RFG) in the post, and a View of those RFGs.
- Create a RFG in some post field group that is assigned to this custom post type.
- In the field group editor, find the RFG and add a custom image field and a URL field. Save the field group.
- When editing a post in wp-admin, you will create a new RFG for each image/link pair. Upload an image and define the link URL for each RFG. We also support creating simple RFGs using Forms.
- To display the image/link pairs in the single post template, you will create a View of RFG. Apply a post relationship filter where the post parent is the current page. In the loop of this View, insert custom HTML to wrap a link tag around the image field shortcode.

Relevant Documentation:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/front-end-forms-for-repeatable-field-groups/

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.

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

Last updated by loriD 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1212220

Tell us what you are trying to do?
okay so the first thing I wanted was to link a url to the featured image. after a lot of research i discovered I can do this using wordpresses custom fields. Although it has a draw back, I think if I could get this same thing accomplished using toolset I would eliminate that drawback. However I also want to be able to add urls to images separately.

so what I want is to add a url (custom field) link to a post type AND and an image (custom field) to the same post time then have them work together. meaning that image now links to where ever the url custom field data tells it to.

I need the data in the post to dictate the linking NOT create the link in the view itself.

Is there any documentation that you are following?
no, i don't understand the documentation. I did look to see if you have this in support. I did try to create one example but it didn't work.

Is there a similar example that we can see?
I no longer have that topic.

What is the link to your site?

hidden link

#1212713

I need the data in the post to dictate the linking NOT create the link in the view itself.
I'm not completely clear what this means but it sounds like you want to be able to upload an image or images to your custom post type. For each image you upload, you want to be able to specify a unique URL. When Users click the image on the front-end of the site, you want to redirect them to the corresponding URL. Have I understood correctly? If so, then you could do this with a Repeatable Field Group (RFG) in the post, and a View of those RFGs.
- Create a RFG in some post field group that is assigned to this custom post type.
- In the field group editor, find the RFG and add a custom image field and a URL field. Save the field group.
- When editing a post in wp-admin, you will create a new RFG for each image/link pair. Upload an image and define the link URL for each RFG. We also support creating simple RFGs using Forms.
- To display the image/link pairs in the single post template, you will create a View of RFG. Apply a post relationship filter where the post parent is the current page. In the loop of this View, insert custom HTML to wrap a link tag around the image field shortcode. I can help with this HTML if you need assistance.

Let me know if I've misunderstood what you want to accomplish. It might help me to see a rough mockup image of what you want to accomplish. I've added some links to documentation for RFGs here:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/front-end-forms-for-repeatable-field-groups/

#1212865

My issue is resolved now. Thank you!