Now a days, wordpress is a great platform for blogging and for even CMS also. Also we can customize the wordpress site with very easy and effective ways. This is due to code functionality and flexibility provided by the wordpress team.
As I have mentioned that we can customize this easily. So here is the one of the portion which we can customize using just in-built wordpress functions.
In this article we will see how we can get all attached image to any post. Wordpess has one function get_children() with which we can achieve this functionality very easily.
Have a look at below code block for the same.
In above code block $post->ID is the post id of which you want to get all attached images. Here you can see that we have filtered the attachments with mime type so we can get images only.
Hope this trick will be useful to you when you are dealing with these type of customisation part.
Avinash Zala currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.
View all posts by: Avinash