Wordpress Custom Fields and Images that don't exist
I have a page (http://schroeder.s482.sureserver.com/york-family-farm/) that is a photo gallery generated from uploaded photos using the Advanced Custom Fields plugin. There is only one photo in this particular page, but other pages could have up to 21 photos. Is there a way to have it only show images that are actually there?
Here is the code that I'm using to display it:
<a href="<?php the_field('featuredimage'); ?>" target="_blank"> <img src="<?php the_field('featuredimage'); ?>" width="290px" height="217px" id="ffs-pic"> </a>
Thanks so much! Love learning from you guys!
I'm guessing 'featuredimage' is a field you created yourself using the Advanced Custom Fields plugin.
Assuming that's the case, you have a few choices.
Still using the free version, you can create 20 more image fields and name them 'image2', 'image3', 'image4', etc... Then insert them into your template the same way you are displaying 'featuredimage'. This has the obvious downside that you have to manually create everything, rather than looping through your images and generating the HTML programmatically.
Let me know if any of that didn't make sense.