Creating my own portfolio custom-type

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

error code: 523