Is there an analogue for has_post_thumbnail() for custom fields ACF plugin?

Want to check if the photo is loaded, show it, and if there is no picture, then show the default picture.
If you load the image thumbnail from the field, check this..
if (has_post_thumbnail()) {
the_post_thumbnail_url()
}else{
 get_theme_file_uri() . '/img/folder/1jpg';
}


But I have a picture loaded from a repeater field (ACF plugins) and simple command (get_field ('my_image')) is not suitable.

Tell me how to write this test?
April 4th 20 at 12:59
2 answers
April 4th 20 at 13:01
Solution
As I recall the repeater works in cycles, so you need to get the image link to a variable and do a check and if OK then print and so on
@rhianna
$staffcard['history_portraitimg']['url'] so I take a picture inside the loop, but substituting in the condition, this system does not work..

if ($staffcard['history_portraitimg']) {
$staffcard['history_portraitimg']['url']
}else{
 get_theme_file_uri() . '/img/folder/1jpg';
}
- fay_Pacocha commented on April 4th 20 at 13:04
the picture loaded as the background for your diva - fay_Pacocha commented on April 4th 20 at 13:07
@fay_Pacocha, so ship $staffcard['history_portraitimg']['url'] variable to check and compare the variable already, and if everything is OK echo and all.

upd var compare to the emptiness or symbols that should be there. - rhianna commented on April 4th 20 at 13:10
@rhianna turned out, thank you - fay_Pacocha commented on April 4th 20 at 13:13
April 4th 20 at 13:03
get_sub_field('image')
thank you. This function is only used inside the loop have_rows() - fay_Pacocha commented on April 4th 20 at 13:06

Find more questions by tags WordPress