It would be incredibly useful to be able to combine the awesome functionality of the Page Link field type, along with the option to supply a completely different link, if you wanted to link to a page on a different site, or even a page locally with a query string on the end or #value.
I had a client request this feature recently, and I have to change to a simple text field, which meant redoing all the links that had been set in this way.
I realise the post ID is what is stored, but perhaps if what’s detected when populating the get_field request is not an integer, then it’s just passed back as the value that’s entered?
Just a thought, would love this functionality to be added in.
I usually implement something like this by creating a radio field first that has 2 options–internal link & external link. Then I set 2 conditional fields based on the choice from that field–if internal, show page link field–if external, show text field.
Of course it’d be nice to have this implemented right in the page link field, but it’s possible to create this functionality now.
One of the reasons that this field may not allow this is that Page Link fields are stored as the ID of the post and an external link would need to be stored as a string. This would also mean that ACF would need to store two values for every field (is it a page or url, and the ID or url value).
I know this is not a solution.
While it means that I have to create 3 fields to do the work I do what jrwdev does. I think it actually makes for a more intuitive and user friendly interface. Asking where the user wants to link makes it more obvious what they might be expected to do.
Also, if I’m building a site with such a feature I would also code the external link to open in a new window/tab and a local page link not to, so I’d want to check and know if it’s an external url or not.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users