How To: Know If The Current Post Has More Than One Images Attached To It?

Few days back I’m working on a blog site of my friend and he’s using Gallery WordPress built-in Shortcode to display attached images in theme single/post page but he don’t want to display any additional image attached if it only contain single image or simply for featured image alone, and I came to the rescue (char), so the idea here is we simply check if there’s two or more images attached then display it or otherwise don’t display anything because mostly it is mean for featured image.

Let’s get started


Paste this code into your current theme’s functions.php file.

Theme File

Paste this code into your current theme’s single.php or page.php file

That’s it happy coding ^_^

by Ryan Sutana