hi,
thanks, correct me if I am wrong but this will work only as long as the function exists?
is there any way which I could force all the existing entries on my db to be updated like this? In layman terms, copy whatever you see at field “the_logo” to the WP featured image field 😀
Hi Elliot,
Actually, I realised that I don’t need to work with “ID” at all. Instead, I can use “Object” type and still have a custom size as a thumbnail.
So what I do now is have a function like this:
/**
* Add automatic image sizes
*/
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'smallsquare', 45, 45, false ); //false: soft prop crop, true: hard crop
}
which creates ‘smallsquare’.
So I can use ‘smallsquare’ with Object and get done what I wanted like this:
<a href="<?php the_field('race_website') ?>" target=_new>
<img class="race_wiki_img" alt="" src="<?php $image = get_field('race_logo'); echo($image['sizes']['smallsquare']); ?>" />
</a>
A very friendly suggestion, perhaps make this clearer in the docs for future users? The way it is written I got the idea that only predefined sizes can be used with Object, but if you want custom sizes you need to use ID.
Thanks for the help
any luck with this..?
Oh by the way, this might help:
I am using “Light – Responsive LightBox” plugin, which says
“Automatically makes all images that link to other images into a responsive lightbox, using FancyBox from FancyApps.”
Could it be that when using the ID, this plugin does not “understand” that it is actually an image object? I don’t know if that makes sense to you 🙂
Hi,
Thanks for the reply, but no the issue is still unresolved..
Perhaps I didn’t make myself clear, let me try again 🙂
Please visit: http://www.justrunlah.com/blog/race/safari-zoo-run-2014/
Then click on the Race logo (the brown square on the top left of the page, right above the star rating). This takes you to a new page showing the image file.
Now, try clicking on a “Route Map” (further down in the same page). It pops up the fancybox, displaying the image.
What I want to do, is make it for the Logo to behave the same way (fancybox pop-up instead of redirecting to the image url). For the maps I return the “object”, while for the logo, I return the “ID”.
I have pasted the codes for both cases on my original post. So, is it possible to recreate effect of code no.1 with ID (code no.2)?
thanks a lot
resolved, thanks!
hello,
will do and ask more specific questions here if needed…
thanks
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.