0

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.

Thanks!

1 Answer 1

3

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).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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