I am trying to show all images on a page in WordPress. My WordPress page is setup like you see in the image below.
What I want to do is show each of these images on a custom page I have made, called Portrait Album. See code below. I guess it is the opposite of this that I want to implement.
I am not sure how I can show each image in the
Text section. Does anyone out there know how to do this? Should be obvious but I cannot find an answer anywhere.
get_content() will show the content, but how can I specifically show the images, so I can show these in a loop enabling me to make a grid using CSS and create a photo gallery.
Currently this is the code I have:
<?php /* Template Name: Portrait Album */ ?> <?php get_header(); ?> <div class="portrait-page" style="background-color: black;"> <?php if (have_posts()) : while (have_posts()) : the_post();?> <?php the_content(); ?> echo "<img src='".wp_get_attachment_url( $the_post->ID )."' />"; <?php endwhile; endif; ?> </div> </div> </div>
What I want to do is something like this, where
col-1-3 is one-third of the width of the page
<div class="row"> <div class="col-1-3"> echo "<img src='"RELEVANT PHP CODE HERE"' />" </div> </div>