I have some code like this.
$counter = 1;
$content = "";
foreach($images as $image) {
$content .= "<li><img src='".$image['images_image'][1]['thumb']."'></li>";
$counter++;
}
echo apply_filters('images_filter', $content);
The above code hides the whole content by using WordPress filters. But I would like to hide only the last 50% of images.
Let’s say I have 15 images.
$hide = floor( $counter / 2 ); //value will be 7
So I would like to hide only images from 8 to 15.
I’ve tried like this. But it’s not working.
if ($counter >= $hide) {
echo apply_filters('images_filter', $content);
}
Can someone tell me the correct syntax?
I don’t know the image filter, but this should work: