Skip Navigation

[Resolved] A gallery shows images that do not belong to the post.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Minesh 1 year, 2 months ago.

Assisted by: Minesh.

Author
Posts
#2652997

Hello!
Within a view I have a gallery that reads a custom field of type Image. This field can be used to create multiple images. This is working well so far.
(The view is of the new, embedded type, not the old, shortcode type.)

However, it doesn't just show the images that are linked to the respective post. After it has displayed the linked images, you can click on the next arrow and more images from OTHER posts will appear.

Can I force (if necessary with a filter hook or something) that only the linked images are shown?

You can see the behavior on this page hidden link. When you hover over an image, a popover appears with the gallery inside. If you click on one of the small thumbnails, the gallery opens.

If you need it, I'll be happy to send access data to the backend! Give me an email address for which I can set up admin access.

Thank you and best regards
Lothar

#2653109

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I will have to check how you configured your gallery images to display.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2653175

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've added the following custom JS code to your view's "Custom JS and CSS" section's custom JS box:
=> hidden link

jQuery(document).ready(function($){
  
  $("div.tb-gallery").each(function(topindex){
   $(this).find("a").each(function(index){
   	$(this).attr("data-lightbox","lightbox-"+topindex);
   });
  
  });

});

More info:
- https://toolset.com/course-lesson/adding-custom-javascript-to-views-templates-and-archives/#steps-for-adding-javascript-to-a-view

#2653409

Hi Minesh,
Thank you so much, that's wonderful!
The gallery should probably be able to do this itself, but the solution works perfectly!
Thanks!!