WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using WordPress to build my photography portfolio. So far I've created a Custom Post Type called session for each photo session, and I've managed to list all the sessions with each thumbnail in the home page.

Now, however, I have to create the content of each session. I'd like to keep it simple:

  • The title
  • A small description (if any).
  • A set of pictures, that should appear straightaway in the post.

The problem is that I don't know how to face the inclusion of the images. Looks like using a gallery is not what I'm looking for, because it generates a set of thumbnails, and I just want the images in full size in the post.

What's the best way of doing this? The ideal case would be to have something like the_images_of_this_post() so I could place them at will from the template file.


share|improve this question
up vote 3 down vote accepted

Attachments are post objects, with post_parent set to the ID of the post they belong to (ie your 'session'). The WP Codex page on wp_get_attachment_image() has an example almost exactly like what you're trying to do: https://codex.wordpress.org/Function_Reference/wp_get_attachment_image#Display_all_images_as_a_list Make sure that you replace the post_parent parameter in that example with the ID of the current session (which will probably be get_the_ID(), though it depends on how your loop works).

share|improve this answer
Thanks! That did the trick, exactly what I wanted :D – José Tomás Tocino Mar 16 '12 at 18:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.