what would be the best way to exclude the current post I am viewing from this recent posts query. Thank You!
<?php
global $post;
if (in_category('top-lists')) {
$myposts2 = get_posts('numberposts=5&offset=0&category=7');
}
else if (in_category('playlists') || in_category('playlistall')) {
$myposts2 = get_posts('numberposts=5&offset=0&category=6,37');
}
else if (in_category('news') || in_category('news')) {
$myposts2 = get_posts('numberposts=5&offset=0&category=95');
}
else {
$myposts2 = get_posts('numberposts=5&offset=0&category=-6,-7,-37,-95,-177');
}
foreach($myposts2 as $post) :
?>
3 s
This the post__not_in
arg should work dandy for you:
$args = array(
'numberposts' => 5,
'offset' => 0,
'category' => 7,
'post__not_in' => array( $post->ID )
);
$myposts2 = get_posts($args);