I´m making a portfolio-style theme where I´m looping in thumbnails from other posts in the same category, under the content of the single post. However, I would like to exclude the post you´re currently reading from the thumbnail listing. Anyone knows how I could do that?
This is what my current loop looks like:
http://pastebin.com/hJ3k1rW6
Outside the loop
<?php $postid = $post->ID; ?>
Inside the loop
<?php if ( ($post->ID != $postid ) && has_post_thumbnail() ) :?>
HTH
David
http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters
'exclude' might not be the right/valid parameter; try 'post__not_in':
change from this:
'exclude' => $post->ID
to this:
'post__not_in' => array($post->ID)
---
to get only posts with thumbnails, you can try and add this to the query parameters:
'meta_key' => '_thumbnail_id'
(or try:
'meta_query' => array(array('key' => '_thumbnail_id'))
(untested)
http://codex.wordpress.org/Function_Reference/WP_Query#Custom_Field_Parameters
)