The new repeatable upload field in Easy Content Types, which was announced yesterday, provides a really easy to use method for creating simple image galleries. We are going to build off of the end result of the Creating a Simple Events System with Easy Content Types and add a minimal, but effective, image gallery to our Event detail page.

The video above demonstrates the method used for creating a simple image gallery with Easy Content Types.

  1. banunn

    Hey Pippin! Thanks for the great tutorial.

    Is it possible to create a lightbox gallery using the repeatable fields.. such as

    <a href="ID, 'ecpt_addimage', true); ?>" rel="lightbox" ><img src="/timthumb/timthumb.php?src=ID, 'ecpt_addimage', true);?>&h=100&w=200&zc=1" class="project-image"/>

    • Pippin

      It looks like your code formatting got messed up a little, but absolutely yes! The only thing you would need to change is that instead of echoing out the get_post_meta() for each image, you need to loop though the post meta and display each key from the array, since the meta for the repeatable fields is stored as an array. Make sense?

  2. Brock Nunn

    I think I understand what you are talking about. Is there any way I could talk you into giving a short code example, I couldn’t find that exact method in the help section.

    Sorry for all of the trouble with this one. I am trying to develop a theme “Helper” plugin wherein I can have images repeat uploaded and output as a slimbox grid gallery.

  3. Brock Nunn

    You sir are a saint and a scholar! But seriously, thank you. I really appreciate you taking the time to lend a hand.

  4. willzemberg

    Hello, good morning everyone.
    Does anyone know when you have the image tag ID, ‘ecpt_fotos’, true);

    Do not have image loading other standard image?

  5. richard carpenter

    Hi Pippin,

    I am trying to use the repeatable upload field for a gallery, here’s my scenario,

    On the gallery page i have a normal grid style gallery. I would also like to add a lightbox when the image is clicked.

    Then,

    on my homepage i have 4 thumbnail blocks “Latest from the gallery” Is it possible to pull the latest 4 images from the gallery onto the homepage?

    I am not using custom post types part of the plugin. Just the meta box part. I am using just the pages using custom template for each page.

    I will be using shadowbox for my light box so just need to be able to add “rel=shadowbox” to the anchor tag


    Thanks for your help

    • Pippin

      Pulling just the first 4 images is pretty simple. Can you show me your current code?

  6. richard carpenter

    I have no code at the moment other than the page code itself, as i don’t know a lot of php.

    http://pastebin.com/mxdYi7yX

    Ideally i would like to output the repeatable fields like this (Nothing special)

    http://pastebin.com/n7fHnsgQ

    Then be able to loop through the latest 4 on the homepage in a similar style list.

    Im currently using wordpress as a CMS for a client, and having this repeatable upload for the gallery is so much better than the default wp gallery.

    Many thanks for your help.

    • Pippin

      Richard, could you repost this in the support ticket you opened? It’ll be easiest for me to help you there.

  7. richard carpenter

    Ok will do. Thanks

    • Pippin

      Sorry for the delay, the ticket was answered yesterday.

  8. Mikee88

    Hi Pippin,

    I want to use the code you posted here for repeatable image uploads: http://pastebin.com/6xji2gvX, but I want to include a repeatable text field as well that will be the caption for each image. I get the general idea of creating the variable for the caption field & including it, but can’t seem to get the details right so if you could help in any way that would be great. Thanks!

    Mike

    • Mikee88

      I solved this today by adding a count. There is another problem I’m having though now. I don’t want an image placeholder to show up if nothing is put in the repeatable upload field. However, I’ve tried if statements I’d normally use for regular fields & they’re not working for repeatable upload fields. It’s like even when there is nothing in the repeatable field, it still is showing there is something. Any idea how to recognize there is nothing in the repeatable upload field & return a blank. Thanks again,

      Mike

    • Pippin

      Try:

      if( ! empty( $field_value ) )
    • mikee88

      That works, thanks!