Quantcast
Viewing latest article 14
Browse Latest Browse All 31

WordPress Query Exclude Featured Image – Don’t display featured image

<?php
	$thumb_ID = get_post_thumbnail_id( $post->ID );
	if ( $images = get_children(array(
			'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; ?>

When displaying a post I don’t want to display the featured image inside the post. Here’s a WordPress Query to do just that:


Viewing latest article 14
Browse Latest Browse All 31

Trending Articles