Shadowbox Gallery DIRECT from Post Thumbnail link
-
Fellow Devs:
I’m trying to render something similar to https://www.eric-powell.com ; in other words, a category view of multiple posts (thumbnails) that will click not through to a single post view, but will instead open the gallery of each post in a shadowbox. I’ve been sweating over this far too long and thought it was time to turn to the forums to see what i could find; alas, no one has really requested this.So here’s what I have for my category.php (truncated for simplicity):
<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <a rel="shadowbox[<?php echo $post->post_name; ?>]" href="<?php echo get_the_link('custom_key=Thumbnail&default_size=full&order_of_image=2&image_scan=false'); ?>"> <img class="thumbnail" src="<?php $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array( 260,165 ), false, '' ); echo $src[0]; ?>" width="260" height="165" alt="<?php echo the_title(); ?>" /> </a> </div>
… and then the continuation of the loop that doesn’t deviate far from the default them of WordPress.
Looking at the code from the aformentioned site (https://www.eric-powell.com), the link is out to the first gallery image; which is why i was trying to call the url for the first image in the gallery, as seen starting on line 4 here.
Result: https://lenaott.com/blog/category/portfolio/
As you can see, shadowbox is working; problem is there happens to be 4 images in that gallery, and they’re not being called into the shadowbox. The code that spits out shows that it’s referencing the proper gallery (or so it seems), just not getting all the images… I’m left with a shadowbox of the thumbnail I’ve clicked on and nothing more.
In the name of full disclosure, I have the following appropriate plugins installed:
- Shadowbox
- get_the_image
- get_the_link (relies upon get_the_image to grab image urls)
I am aware that eric-powell.com uses the gallery theme, however due to the unnecessary loading of lots of different things that come along with the thematic framework, I’ve opted to build a custom theme instead; I’ve scoured the functions.php file of that particular theme and child theme with no luck… in fact I’m sure it’s been changed, as the functions.php of the gallery theme calls merely a permalink for the anchor that the thumbnails(s) are wrapped in.
Any and all help is ALWAYS greatly appreciated! Even paid if my mind is blown (which it likely will be… either that or I’ll be dumbfounded by my own stupidity in overlooking something clear).
- The topic ‘Shadowbox Gallery DIRECT from Post Thumbnail link’ is closed to new replies.