WordPress Code Snippets

A fresh mix of code snippets and tutorials

Display all images attached to post


Another technique for working with WordPress attachments, here’s how to display all images that are attached to the post, either before or after the existing post content.

For example, if you are using my User Submitted Posts, the following code will display all of the attached images to the post content. Add this to your theme’s functions.php file:

One spiffy thing about this technique is that there’s no editing required. Just drop it in and good to go. Of course, you’ll want to style with CSS and possibly customize the PHP/HTML to suit your needs.

You may also be interested in my tutorial for setting attachments as featured images. It’s just good times.

Learn more

WordPress Themes In Depth

Show Support

Like our new Facebook Page to show support!