Home Forums Front-end Issues Using ACF shortcode inside html tag


Using ACF shortcode inside html tag

  • Hello,
    I am trying to display a URL on the front end, I would like the same URL to appear on the front end as both anchor text and hyperlink.
    For example, if the custom field value is “” then I would like to appear on the front end, so the anchor text is “” and the hyperlink itself will point to “”

    So I went to ACF and created a URL custom field, I named it homepage_url.

    Then I saw a new URL custom field in back end, I added the value “” into the new URL custom field.

    Now, all I want is to be able to insert the value of this new custom field and display it on the front end, using ACF SHORTCODE.

    So I open the post editor and added the following code:
    <a href="[acf field='homepage_url']" target="_blank" rel="noopener">[acf field='homepage_url']</a>

    But when I looked at the result, I saw that now I have regular plain text on the page, not hyperlink. The regular plain text display (correctly) the value, but its a plain text, I would like it also to be a hyperlink that actually links to

    How can I do just that?
    I assume that the problem is with the following string: href=”[acf field='homepage_url'], how should a correct string look like?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.