Single page : prevent same post from appearing in sidebar ?
I have in my theme a nice and rather classical list of “Recents articles” showing title, excerpts, thumbnails, and read more.
But let us say I click on the first excerpt. I am now reading the whole article, with its full size picture.
Problem : in the sidebar, next to the article, I still have my “recent articles” showing… And very logically showing the exact same (smaller) picture, the same title, and the same text (excerpt).
Is there a way to tell WP :
“if article already displayed, do not show in list of recent posts” ?
my code for my recent articles :
<ul ><?php global $post; $myposts = get_posts('cat=6&numberposts=15'); foreach($myposts as $post) : setup_postdata($post); ?> <li <?php the_post_thumbnail();?> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a> <?php the_excerpt(); ?> <?php endif; ?></li> <?php endforeach; ?> </ul>
- The topic ‘Single page : prevent same post from appearing in sidebar ?’ is closed to new replies.