/ Published in: PHP
This snippet will exclude the featured image from the attached images (gallery)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $thumb_ID = get_post_thumbnail_id( $post->ID ); 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'exclude' => $thumb_ID, ))) : ?> <ul> <?php foreach( $images as $image ) : ?> <li><?php echo wp_get_attachment_link($image->ID, 'thumbnail-latest'); ?></li> <?php endforeach; ?> </ul> <?php else: // No images ?> <!-- This post has no attached images --> <?php endif; ?>