function lsmwp_post_limter($ids, $in, $count) {
$i = rand(1,$count);
if ($i <= $in) {
return($ids);
}
else
return false;
}
function lsmWpfilter($posts){
$result = [];
foreach($posts as $post){
$res = lsmwp_post_limter($post['postId'], $post['in'], $post['count']);
if ($res){
$result[] = $res;
}
}
print_r($result);
return $result;
}
$exluded_posts = array(
array('postId' => 28741 , 'in' => 2, 'count' => 3),
array('postId' => 29811 , 'in' => 2, 'count' => 3),
array('postId' => 31951 , 'in' => 1, 'count' => 3)
);
$custom_args = array(
'post__not_in' => lsmWpfilter($exluded_posts),
);
This method allows me to use different in/count for each excluded posts, not limiting it to 1/5 and also making use of funcitons