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),
);
这种方法允许我对每个被排除的帖子使用不同的in/count,而不是将其限制为1/5,也可以使用函数