Home Forums General Issues Display a linkable URL and Remove the comma


Display a linkable URL and Remove the comma

  • Hello

    I’ve been using ACF and a few things have got me stumped.

    I have a site setup in elementor and have tried using the URL and Link fields in ACF to allow users to put in a website domain in a field for a member profile.
    However when ever it displays via ACF shortcode, the url is not linkable, how do i make it link to the URL thats been put in the ACF field?

    How do i remove the commas between the icons, under whats on offer?


  • managed to sort the comma, but how do you get the URL to display or link correctly?

  • This cannot be done using just ACF unless you build your own shortcode. You may want to direct your question at elementor. But I can’t say because there’s not enough information about how where or how you are attempting to output the URL.

  • In ACF I have a field with “url” as the type.
    Which then appears in the custom post for the user to put in a url.

    Then on the page, which is built with elementor, I am using ACF shortcode to display the url as I couldn’t do it via the normal way in elementor.
    I was told to put the shortcode in an <a href but it didn’t work or only half works.

    a href=”<?= website(‘my_link’) ?>”>[acf field="website"]

    I am guessing the “my link” bit would be the url but I don’t want to manually put that in each time. So at which point I got stuck.

    I would like the url to display as it does and then link to the site.

  • You cannot use shortcodes for the href value. This will not work.

    <a href="[acf field="website"]">[acf field="website"]</a>

    You can also not use PHP as you’ve done in your code.

    Neither of these methods are supported by WP.

    The only way to do this is to create a custom shortcode that outputs the entire link.

  • Ok, so what is the “URL” field type used for in ACF? Should i be using something else?

    Is there a shortcode already setup to do what i am trying to achieve?


    I came across this problem which is similar to what i want to do and you talk about using a text field with custom validation. So do your text fields contain a url that a user puts in, which the url is displayed on website frontend and is also clickable/linkable to the relevant url?

    How do i achieve that?

  • The issue is that you’re using elementor. I do not use elementor or any other tool/plugin that does my coding for me. If I want to use a field as a link I open the php file where it will be used and add something like

    <a href="<?php the_field('my-url-field'); ?>">Link Text Here</a>

    ACF does not have anything built in that will do this for me.

    When using another tool to do coding for you then any questions related to how to use a particular field should be addressed to the author of that tool.

    As far as using a text field or some other type of field, I do not know how the person in the other thread managed to use a text field, because, again, I don’t use elementor. You might want to try posting a comment in that thread and asking him for more information about how it was done. He does supply a link to get more information from.

  • I am using elementor but i was using the ACF shortcode like you use it in wordpress so elementor isnt a problem.

    Im new to ACF, so i was trying to understand how to create a clickable link. Looking at the field types in ACF, URL looks like the one you use for someone to fill in a url and then on the front end it appears for someone to click on.
    But looking at your answer on the post i linked, it seems otherwise, plus your answer saying…

    “Just a little off topic, but I don’t use URL fields much. I basically always use a text field. URL fields are too limiting. I want to allow users to enter any valid href value, so I use a text field and then add custom validation to to it.”

    So reading the original post and then your reply to it, sounds like you use a text field with some custom code to allow users to fill in a url in the backend for it to display on the frontend of the website and allow visitors to click it, am i right in thinking this?

  • There isn’t any way to use a shortcode to do what you want to do, it just is not possible in WP and ACF’s shortcode is only for simple text fields. To accomplish this you would need to create your own custom shortcode.

  • I solved putting a <a href="XXX"></a> in a text field and works!

  • Not sure if anyone is still looking for a quick fix, just use the “Icon List” element to pull the ACF field for the title and link and remove the icon if you don’t want it to show.

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

You must be logged in to reply to this topic.