• Hi EkoJR,

    I’m using Advanced Post List to display a list of company logos. The logos are inserted into each page/post by using the image field in Advance Custom Fields. The image field is named “featured_partner_logo” in ACF. Here’s the code I’m using in APL:

    <a href="[post_permalink]"><img src="[post_meta name="featured_partner_logo"]" alt="[post_title]"></a>

    But instead of returning the image URL, I’m just getting the image ID (for example “136”). I’ve tried several things in ACF, but the only way I can get the image URL to display properly is to change the image field in ACF to a URL field and then paste the URL directly into the field. It works, but it’s not super user friendly.

    Have you encountered a problem like this before? And is there a work-around?

    Thanks in advance ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author EkoJR

    (@ekojr)

    The first thing that comes to mind is the format. It grabs just a Unique ID which isn’t always useful with URLs, and the use of the img element & post_meta could be used in an alternate format.

    It should be possible to either grab a different Post Meta variable AND/OR change the format for grabbing URL data. Instead of trying to grab a URL, try designing a dynamic URL format (ex www.abc.com/image?ID=[IMAGE_ID] or www.123.com/image/[slug].jpeg).

    <a href="[post_permalink]"><img src="https://website.com/image/[post_meta name="logo_slug"].jpeg" alt="[post_title]"></a>

    If it’s just the Featured Image that you are interested in, there’s the [post_thumb] shortcode as an option if you haven’t already looked into yet.

    • This reply was modified 8 years, 1 month ago by EkoJR. Reason: examples, not links
    Thread Starter Peter Islin Nielsen

    (@essens)

    Hi EkoJR,

    Thank you for your reply. I’ve tried to design a dynamic URL format as you proposed, but I can’t get it to work. I must be doing it wrong:

    <a href="[post_permalink]"><img src="https://site.com/subfolder/wp-content/uploads/image?ID=[post_meta name=”featured_partner_logo"]" alt="[post_title]"></a>

    I thought about using the Featured Image instead, but I would like to reserve it for other purposes if possible.

    Plugin Author EkoJR

    (@ekojr)

    The only thing I can think of is playing around with the URL address until you find how the site uses URLs. It’s been awhile since I’ve messed around with ‘pretty URLs’, so I can’t recall off the top of my head.

    Plugin Author EkoJR

    (@ekojr)

    Have you been able to find a solution to this issue?

    Thread Starter Peter Islin Nielsen

    (@essens)

    No, unfortunately not. I tried several different things, but I never got it to work. Instead I used the Featured Image as you proposed – that worked like a charm ??

    Plugin Author EkoJR

    (@ekojr)

    I wish I was able to help you better, but the only alternate option I could think of was a dynamic permalink structure. Glad you were able to still get it working though. Just wanted to make sure before I mark this as resolved. Thanks for replying ??

    good Morning, have you found an issue about this problem?
    Here is my actual syntax,

    <table><tr><td colspan=”2″ bgcolor=”993333″><font color=”#FFF”><b>[post_title]</b></font></td></tr><tr><td></td><td>- [post_date] -<br/>[post_content]<hr/></td></tr></table>

    when looking on your doc: [guid] – original URL of the page/post (post_permalink is probably better)

    all the featured Images i use in my posts are based in the media library
    e.g “https://frspc.lu/wp-content/uploads/2015/08/Journ%C3%A9e-cc_2016_007.jpg&#8221;

    maybe you could help me with another “[post_image]” or sth similar?

    with my best regards,

    Pol Daems from Luxemburg

    Plugin Author EkoJR

    (@ekojr)

    When adding code, it helps to use code when displaying various syntax.

    However. there seems to be a misunderstanding with the [guid] shortcode, which isn’t the Image URL. It’s the post/page url. What your thinking of is [post_thumb], which will grab the URL you are looking for.

    Lately, I’ve been trying to get documentation filled for the plugin. Let me know if the information in [post_thumb] helps.

    Thanks this was exactly what i was missing!!
    Great!
    now i will may have to check to get smaller space between each news, acutally i manage the news via html table, will have to check what i can do.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Image field is returning ID instead of URL’ is closed to new replies.