Adding a Second Image Gallery to Listings

Hello HivePress Community,

I am currently working on a project where I need to implement a second image gallery for each listing on my HivePress site. I have successfully added a gallery feature to the vendor profiles using the standard methods provided by HivePress, but now I’m looking to replicate this functionality specifically for listings.

To elaborate, I want to have two separate galleries for each listing: one for the primary images and another for additional images (like a secondary gallery). This would allow listing owners to showcase different aspects of their offerings more effectively.

I have some experience with modifying the HivePress templates and using hooks/filters. However, I am unsure how to approach this particular requirement. Specifically, I am looking for guidance on the following points:

  1. Best Practice for Implementing a Secondary Gallery: Is there a recommended way to add a second gallery to the listings? Should I create a new custom field or is there a more integrated approach?
  2. Modifying the Listing Model: What changes would be needed in the Listing model to support an additional gallery? I’m thinking about how to handle the storage and retrieval of the image IDs for the second gallery.
  3. Frontend Display: Suggestions on how to modify the listing templates to display both galleries separately, ensuring a good user experience.
  4. Backend Management: How can I make it intuitive for users to manage both galleries from the backend, especially in terms of uploading and organizing images?

Any insights, code snippets, or pointers to relevant documentation would be greatly appreciated. I’m eager to learn the best way to implement this and ensure it integrates smoothly with the existing HivePress functionality.

Thank you in advance for your help and guidance!

Best regards,


I’m sorry for the delay. Unfortunately there’s no easy way to implement the second image gallery because the framework doesn’t support multiple files for the Attachment field type yet. The easiest way is probably searching for the “images” keyword in the code on Github and duplicating all the logic, changing the field name only (via hooks, to prevent losing changes on update).

Also, you’ll have to override one of the template parts using a child theme, or insert a new template part via the template hooks, to show this custom gallery on the listing page.

I recommend starting with a single image attachment field, you can add it via the hivepress/v1/models/listing/attributes hook and it’ll appear both in the front-end and back-end forms.

Hope this helps

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.