I am adding an image gallery via wp media uploader. In the frontend, I am trying to show these images in Thickbox pop-up. However, it shows the images in pop-up but when I navigate [next and prev images] it suddenly works and an error is seen in the console.
This is the error: http://example.com/wp-content/uploads/2019/03/IMG_0139.jpg&width=753&height=470?random=1555568706302 404 (Not Found). If I paste this url, 404 page is seen.
All in all, the navigation buttons are not working properly. If I add 2 images in gallery, the next button box works but prev button throws error. If I use more than 2 images, the next disappears after second images and prev button fails as well.
This is my code for front-end where images are displayed:
<?php foreach ($ids as $key => $value): $image_medium = wp_get_attachment_image_src($value, 'medium'); $image_full = wp_get_attachment_image_src($value, 'full'); $attachment_title = get_the_title($value); ?> <li> <a rel="gallery" href="<?php echo esc_url($image_full); ?>"> <img class="guide-gallery-image" alt="<?php echo esc_attr($attachment_title); ?>" src="<?php echo esc_url($image_medium); ?>" /> </a> </li> <?php endforeach; ?>
This is how I have added
thickbox() resources (css and js) in my footer:
<?php add_thickbox(); get_footer(); ?>