Reputation: 61
I have a custom post type 'events'. On 'single-events.php ' i want to display the similar posts related to this . I am using the following code but the problem is it is also displaying the current post. How do i get rid of current post, please help me out.
<?php
$args = array( 'post_type'=>'events',
'tax_query' => array(
array(
'taxonomy' => 'Event type',
'field' => 'slug',
'terms' => $type,
)
)
);
$postslist = get_posts( $args );
?>
Upvotes: 0
Views: 71
Reputation: 352
You could try to make a if
condition into your loop which asks for the id of the post not to be the same of the current post.
Upvotes: 1