I've created a custom post type called product. On my theme's product page, I want to be able to show a basic list of images (ul>li>a>img) on a sidebar like this (quickly googled :P):


I want these images to be shown on the post edit screen with a way to add more, delete and ideally, sort them manually.

So far I tried two approaches that I disliked:

  • Looping through the post attached images (get_attached_media( 'image' )). The problem with this is that adding them is quite complex and counter intuitive. (Add Media > Delete the link on post, plus a complicated way of visualizing the images on each product.

  • Using a native Wordpress gallery. The problem with this is that it requires a tag in the Wordpress theme, the location is therefore configurable and it takes a place on the content flow. I know I could replace it with JS but I rather not.

I'm looking for a native way, custom code or free plugin. Thanks in advance.

  • If you want to code then you should be using (add_meta_box)[codex.wordpress.org/Function_Reference/add_meta_box]. Here you should have to input field. 1 for the image upload and 1 for order. And also you should use jQuery for making it repeatable. Or simple use available plugins.
    – Karun
    Jul 6, 2015 at 5:07
  • @Karun Any plugin to recommend? I rather nor reinvent the wheel. I've been searching around but couldn't find any that suits me well.
    – Mauro
    Jul 6, 2015 at 13:00
  • You can search the WordPress plugin directory to search for desired plugin. Recommendation is off topic. help center
    – Karun
    Jul 6, 2015 at 13:09
  • I know that. I just wasn't able to find any that's unpaid (I found this one advancedcustomfields.com/add-ons/gallery-field but's paid).
    – Mauro
    Jul 6, 2015 at 16:16
  • 2
    The "core" way to maintain list of images attached to a post isn't very straightforward, however WP provides all the tools you need to build an effective UI. Problem is that it isn't possible to write an answer that explains how to do, because that will be so much for an answer. Surely there're plugins out there that can do what you're looking for, but suggesting plugins is out of the scope of this site. In short, IMO this question should be closed either as off topic or too broad. Being a bounty question it can't be closed, but I'll not be surprised if it will get no (good) answer.
    – gmazzap
    Jul 19, 2015 at 14:53

1 Answer 1


Screenshot of edit screen http://www.sitekick.com/static/img/193593.jpg

I am working on something that uses images in a very similar fashion. As mentioned, you will need to implement custom meta boxes for your 'product' post type to create an image field. I use the CMB2 framework to build out the meta boxes. It provides several field types, one of which is file_list.

File_list allows you to set multiple images via the native media manager. You sort by dragging the thumbnails in the desired order; delete with the red minus icon, and add more.(see screenshot)

On the frontend, I use get_post_meta to get the image data. In my case I build out a slider with the help of wp_prepare_attachment_for_js, but you could obviously use it in a widget or your theme.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.