Omit the duplicate post ID from sidebar
-
The code below is to display latest posts on sidebar from the same category of single page. But how do I filter out the sidebar post if one of 10 recent posts is reading
<?php global $post;
$categories = get_the_category();
foreach ($categories as $category) :
?>
<h3>More News From This Category</h3></p>-
<?php
- “><?php the_title(); ?>
- term_id);?>” title=”View all posts filed under <?php echo $category->name; ?>”>ARCHIVE FOR ‘<?php echo $category->name; ?>’ CATEGORY ?
$posts = get_posts(‘numberposts=10&category=’. $category->term_id);
foreach($posts as $post) :
setup_postdata($post); ?></p><p><?php endforeach; ?></p>
<p><?php endforeach; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Omit the duplicate post ID from sidebar’ is closed to new replies.