Thread Starter
whoo
(@whoo)
Anybody fancy a crack at this?
Thread Starter
whoo
(@whoo)
Unfortunately that just displays 3 posts from each year. I have tried various numbers with the ‘posts_per_page’ but it doesn’t seem to fix it.
i’m sure there are more than one solution to this problem, and the:
$posts_to_exclude = array(4305);
if(!in_array($post->ID, $posts_to_exclude)): seems the most likely to do it. I just can’t figure out how to create the array of the 3 latest posts.
Thanks for the response though.
So you want to exclude the 3 latest post from every year?
Thread Starter
whoo
(@whoo)
Just the most recent, current year.
I am also trying to exclude certain categories now?
Thread Starter
whoo
(@whoo)
I’ve managed to exclude the categories using:
if(!in_category( array( 'websites', 'videos', 'identities', 'infographics-our-work', 'case-studies' ))):
try it with this: http://pastebin.com/V7MJ99te
Change this $exclude_categories = array(3, 25); to the correct category IDs.
Thread Starter
whoo
(@whoo)
Really close, thanks!
It has removed the categories very neatly – great!
It has removed the latest/ first post (singular) but the next 2 are still showing up. Any ideas?
For testing can you put this:
echo '<pre>';
print_r($post_ids);
echo '</pre>';
after this:
foreach($three_latest as $post){
$post_ids[] = $post->ID;
}
Thread Starter
whoo
(@whoo)
Ha, of course you already knew I had missed one category.
I don’t know if you can hear, but there are chants of ‘keesiemeijer is a legend’ resonating from South london.
I salute you!
lol. I’m glad you got it resolved.