Post thumbnails outside the loop
-
My sidebar is as follows:
<div id="sidebar"> <h2>Beste Aminos</h2> <ul id="top-producten"> <?php $rand_posts = get_posts('numberposts=5&orderby=rand'); foreach ($rand_posts as $post) :?> <li> <h2><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2> <p><a href="<?php the_permalink(); ?>"><?php $key="subtitle"; echo get_post_meta($post->ID, $key, true); ?></a></p> <?php get_the_post_thumbnail() ?> <?php wp_gdsr_render_article();?> <p class="meer"><a href="<?php the_permalink(); ?>">Meer informatie & bestellen</a></p> </li> <?php endforeach; ?> </ul> </div><!--/#sidebar-->This is probably the most i can make from my php skills.
The problem occurs at the post_thumbnail: The sidebar repeatedly displays the thumbnail of the active page instead of the thumbnails of from the linked posts.
I tried some solutions I found on the net, but none of them are working.
Who could help me out, please?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Post thumbnails outside the loop’ is closed to new replies.