Skip Navigation

[Resolved] Links to custom fields

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

Problem:

The issue here is that the user wanted to click his custom fields on the frontend so that they link to other posts with the same values

Solution:

The only way that I see this possible is to create a view that would take the value of the custom field and filter the view by that custom field for all the other posts that has that field value.

So the first thing you need to do is to create a view and set it to the Citations cpt.

Click on the Query Filter section then add a filter for this particular custom field. Set the field to get the value from the url. See Screenshot in thread @https://toolset.com/forums/topic/links-to-custom-fields/#post-919008

Once you have done this scroll to the Loop Output section to customize how you want your content to be displayed. Next just create a specific page and then just add this view to the page.

To link to this view you will need know the link of the page and then pass the parameter.

So the link would be something like this

<a href="linktoviewpage/?param=[type field='my-custom-field'][/types]">[type field='my-custom-field'][/types]</a>
This support ticket is created 6 years, 4 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#918864

Hi there,
On this page:
hidden link

I have created a custom post type called Citations.

You can see that i have lots of "related" information on the right hand side of the page. Some of that info are tags, like Plaintiff Claim Type and Geographies. And those link to the respective taxonomy archive page, which is good.

Is there a way to have similar links to fields that are not taxonomies? For example, the Product Stage in Development field is a checkboxes field. What I would like is for that entry or entries to be links to all the other Citations that share that same entry, just like how the taxonomy fields work.
Or do I need to change that field from checkboxes to a taxonomy?

#919008

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-06-28 at 2.11.29 PM.png

Hi John,

Thank you for contacting our support forum.

The only way that I see this possible is to create a view that would take the value of the custom field and filter the view by that custom field for all the other posts that has that field value.

So the first thing you need to do is to create a view and set it to the Citations cpt.

Click on the Query Filter section then add a filter for this particular custom field. Set the field to get the value from the url. See Screenshot

Once you have done this scroll to the Loop Output section to customize how you want your content to be displayed. Next just create a specific page and then just add this view to the page.

To link to this view you will need know the link of the page and then pass the parameter.

So the link would be something like this

<a href="linktoviewpage/?param=[type field='my-custom-field'][/types]">[type field='my-custom-field'][/types]</a>

Please let me know if this helps.
Thanks,
Shane

#919029

HI Shane,
in the screen shot you attached, you put in the value "my_url_paramter"
Should I use that same value, or should I use the field name?

Thanks!
-John

#919047

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi John,

You can actually use any value you want. I use this value just as an example so that you can see how its all linked.

Thanks,
Shane