Support » Fixing WordPress » How to display images separate from content?
4 years, 9 months ago
How can I display a posts’ images separate from the_content? i.e. in another table cell.
I’ve been trying get_image_attachment etc… in my theme but it hasn’t been working for me.
The [gallery] shortcode is the most common approach.
But I’m guessing that you probably want something like this for a template:
$images = get_children( array(
'post_parent' => $post->ID,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID'
Then use foreach to cycle through the images with wp_get_attachment_image()
4 years, 8 months ago
Okay, can you help with the foreach part please?
Perhaps help me with a code that I can get to work on my page please?
Okay, I got it to work, the problem was that on my local server there were no local attachments, so they weren’t showing.