• Resolved mintdave

    (@mintdave)


    Hi,
    I have created a custom field called ‘article-url’ using the ACF plugin. For this field, each entry has a ‘value’ and a label’ (For example one value would be: https://www.time.com, and the label would be ‘Time Magazine’).

    I am trying to display the field label on the frontend, which also links to the field value, when the user clicks on it (So, my website would display ‘Time Magazine’, which would link to ‘www.time.com’)

    I have used the following code:

    <strong>Source of this article:?</strong><a href="[field article-url]">[field article-url out=label]</a>

    However, the problem is that when I click on the label on the front end, it leads me to https://wwww.mywebsite.com/www.time.com, rather than just https://www.time.com. In other words, it assumes my article-url is relative to my website. How do I change this to an absolute url?

    https://www.ads-software.com/plugins/custom-content-shortcode/

Viewing 1 replies (of 1 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Sorry for the late response. This is happening because the URL doesn’t have https:// in front of it, and the address is interpreted by the browser as being an internal link.

    There is a convenient parameter to add the protocol if it’s not there already:

    <a href="[field article-url http=true]">

Viewing 1 replies (of 1 total)
  • The topic ‘Question about how to reference an absolute URL, not a relative one’ is closed to new replies.