Custom module : how to make custom field image a link to the article ?

Posted in: Newspaper
Post count: 5

Hello,

I’m building a custom page, with a Flex Block Builder and a custom module (from a blank template).
For every article in the loop, I successuflly recall an image through a custom field image.
Now I would like to make this image a link to the article.
I suppose I could use the “URL” field with a sort of {…} snippets ?
Is there a place where I would find the documentation about the custom codes “{…}” ? (I means like this one {cf_nameoffield} quoted here : https://forum.tagdiv.com/topic/link-url-in-custom-field/ )

Thank you

  • This topic was modified 1 year by Jindra.
Post count: 21065

Hello!

Why do you not like to use the module featured image shortcode? So, in the flex block builder, it will come exactly the featured image of your each post, and when you click on the image, it will lead you to the article page.

Thank you!

Post count: 5

Well, for some reason I need to display another than the featured image.
The featured image is fine for the homepage, but we sometimes use another, specific image (a quote, a portrait, etc) on social networks.
So I need a page displaying the same image as the visitor saw previously on our Instagram account.

  • This reply was modified 1 year by Jindra.
Post count: 21065

Hello!

Then try to use the Single image shortcode that have a field to insert an image link.
The problem appears in the flex block builder because it will apply the same image or you can add multiple flex blocks builder with different module created custom for each post/article.
With custom fields, you will need custom code: https://support.advancedcustomfields.com/forums/topic/how-to-link-an-image-field-to-an-external-url/

This will require custom work, which is not covered by the support team.
For customization and other services, you can contact our custom work team here: https://tagdiv.com/premium-customization-services/.

Thank you!

Post count: 5

Thank you for your feedback !

Unfortunately I need a flexible solution : first attach an extra image to a post (via custom field, which works fine), then display these extra images of selected articles (which works fine too), ant finally make these images clickable – in order to get to the article.
Here I was thinking of the “url” field, with some kind of url snippet…

I understand that the customization is not covered by the support team !
Is there a place where I could find some further technical/developper documentation ?

Post count: 21065

Hello!

Another workaround that came to mind is to add the custom field shortcode, choose the image field in the acf field, and for the URL to write {cf_nameOFtheURLfield}, and there you can have an image with a link. Check this screenshot: https://app.screencast.com/KidrAmdRtDAZ1

Thank you!

Post count: 5

Thank you ! This works fine !
I suppose there is no such thing as a direct snippet to the post url, like {post_permalink} ?

Post count: 21065

Hello!

Unfortunately, no.

Thank you!

Post count: 5

ok, thank you !

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.