I am trying to call in a page's featured image outside the loop.
This is the code I'm using in the sidebar:
$my_page = get_posts("p=$page_id"); if( $my_page ) foreach( $my_page as $my_post ) : setup_postdata( $my_post ); the_post_thumbnail(''); endforeach; wp_reset_query();
It had been working fine earlier but for some reason now the featured image is repeating five times on the page, one underneath the other. Any clues as to why would be appreciated. I've tried turning off everything else in the sidebar thinking something else (widget or whatnot) might be conflicting, to no avail.
The code was found here: http://wordpress.org/support/topic/display-featured-image-on-indexphp-outside-the-loop
Thanks for any suggestions.