Reputation: 24798
Multiple featured images
In Wordpress you can set a "featured image". I need to add multiple featured images dynamically.
Dynamically number of featured images
When I say dynamically I mean, for one post I might want 2 images and for the next one 6 featured images. The number is unknown.
Just loop them out, when done
When in the theme I just loop them out with a foreach loop. Featured images are stored as custom fields. This part I can handle.
A plugin might do it?
I know of http://wordpress.org/extend/plugins/multiple-post-thumbnails/ but here I need to deside the number of images from the start. My number is unknown.
Plugin, script or good articles are welcome.
Upvotes: 1
Views: 14386
Reputation: 3475
I recently added a plugin to a wordpress plugin repository which simulates the need of dynamic multiple featured image. You can check it out here.
Any suggestion, pull requests, issues, and plugin recommendations are more than welcome! Interested can join the development at GitHub.
Upvotes: 6
Reputation: 24798
The answer was to use Advanced Custom Fields. It's very powerful plugin for adding custom fields of all kinds.
The addon "Repeater" did the trick.
Upvotes: 2
Reputation: 2387
Depending on how you're planning to use your featured images, you might be able to just add them as a gallery to your post/page. Then, you could use one of these snippets to access your gallery images on your listing and detail pages:
The biggest drawback to this method is that they aren't featured images by the strict WordPress definition, so any themes or functions that are depending on them won't exactly work right.
Upvotes: 1