Skip Navigation

[Resolved] Custom Field with link to page url

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

Problem:
The issue here is that the user wanted to add their post URL to the custom field output on the frontend.

Solution:
This can be done by using the code below.

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

You only need to replace 'pagecounty' with the slug of your custom field.

This support ticket is created 4 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
- 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)

This topic contains 4 replies, has 3 voices.

Last updated by davidA-20 4 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#2013447

Hi

I have a view in my site footer with links to my county pages. -

hidden link

At the moment the view shows the page title, linked to the url of the page. To save space and stop the repetition of "Stone Floor Cleaning", each page has a custom field with the name of the county, e.g. Pows, West Midlands, Glasgow etc.

I want to just show the custom field - county name - linking to the page.

I have tried to work this out myself but can't work out how to achieve it.

I look forward to your reply

#2013593

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I'm guessing that you are using the legacy editor for Views (using markup and shortcodes) rather than the Blocks interface, and that your View that lists these pages in the footer currently outputs the page titles as links using the wpv-post-link shortcode.

That generates a link to the post and the link text is the title; it's not possible to specify alternative text to use.

But you can create your own links, something like this:

<a href="[wpv-post-url]">[types field="county-field"][/types]</a>

There, the text is generated from the custom field value (you'll need to use the appropriate field slug) while the link href comes from the target post (or page in this case).

#2013889

Thank you, you got it.

My ignorance is how to get the url for the page.

I have tried


Shane
Supporter

Languages: English (English )

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

Hi David,

Here is the correct format below.


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


Please let me know if this works now.

Thanks,
Shane

#2014425

My issue is resolved now. Thank you!