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!

Answers


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.

  1. 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.

  2. Buy one of his add-ons like Gallery or Repeater. They are meant for this sort of thing, and will save you a lot of work.

Let me know if any of that didn't make sense.


Need Your Help

How retrieve details of table element clicked?

javascript sapui5 sapui

I have a table and I want retrieve a item details of a element that i sesect:

Async map with multiple insert inside

node.js mongodb asynchronous

I need to insert inside a MongoDB a list of topics with unique slugs.