Adding Featured Image to Gallery
-
I use the featured image field for the main image of my posts and for additional images I’ve styled this plug-in accordingly as thumbnails across the bottom of the main image.
I would like the prettyPhoto plug-in to work whether there is additional gallery images or only just the one featured image.
Everything works fine when theres additional images added to it. I can click on the featured image and it loads into the gallery with the rest of them. The problem arises when I have JUST the ONE featured image. It dosen’t load correctly into the Lightbox. It simply pops the image up with no styling, almost as if the Easy Image Gallery JS and CSS are not being loaded.
I can’t figure this out for the life of me and have tried several different solutions.
Heres the code calling my featured image from Single-Post.php:
<?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') ); ?> <div> <a href="<?php echo $url; ?>" rel="prettyphoto[group]" style="cursor: pointer;"><?php the_post_thumbnail(); ?></a> </div> <?php endif; ?>
Could you please lead me in the right direction so that no matter if theres gallery images or not in the post, this featured image can be opened in a prettyPhoto lightbox as a single image.
If you need more info, please let me know. Thanks so much in advance…
All the best –
- The topic ‘Adding Featured Image to Gallery’ is closed to new replies.