Jeradin / acf-website-field

Advanced Custom Fields add-on for Website URLs, allows for website URL, title and a checkbox to open externally or internally
59 stars 14 forks source link

Any way to use relative links (by not adding http)? #23

Closed cousinisaac closed 9 years ago

cousinisaac commented 10 years ago

This is a great add-on that saves me time. Thanks for the good work!

And, it would be even better if the admin could choose to enable the automatic adding of "http://" or force the content editor to add it manually so that they can use relative links with out the "http://" if so desired.

One use case for this is when you have a staging server and want to create links to pages on staging and have them still work when exporting the content to production without having to edit the links again or do a find-and-replace on the database.

It would be extra nice to add wordpress's link picker tool. I imagine Links picked with that tool would be dynamic and thus their base url would change when imported to another server.

Anyway, just my two cents.

Thanks again,

isaac

Jeradin commented 9 years ago

Thanks for the suggestions, I just went through adding HTML5 validation and website URL validation for the admin section which sadly does not allow for relative paths. I can look at adding an option in the future to bypass validation for the field.

I like the build it link picker, will look into that, like combining the "Page Link" field with a title option?

jeremyschuler commented 8 years ago

A quick workaround is to use the field type 'text'. For example:

Venue Link Insert relative link to venue page. ie. /page-slug

<?php if(get_field('venue_url')) { echo '<a href="' . get_field('venue_url') . '">Venue Info</a>'; } ?>