I’m a little lost with this one, so I’m really hoping for some help as to how to modify the code below into something that works for me. I'm using the CPTUI plugin and it's working fine. The code snippet below is from a modified Ordered List that I created. It's displaying the page, as it should, in ordered list with a thumbnail. All is working as it should. However, I'd like to display this as a row of three table cells
here's a link to the code I have > https://pastebin.com/N44fyEhB
The code snippet for the while loop:
<?php $args = array( 'post_type' => 'the_members', 'orderby' => 'ID', 'order' => 'DESC', 'posts_per_page' => '200' );
$ourposts = new WP_Query( $args );
if ( $ourposts->have_posts() ) : while ( $ourposts->have_posts() ) : $ourposts->the_post(); ?>
<li><a href="<?php the_permalink();?>"><?php the_post_thumbnail( array(200, 150) );?></a><br><?php echo get_the_date( 'Y-m-d' ); ?> </i></li>
<?php
endwhile;
endif; ?>
What I’m looking for is a way to display 3 columns in a single row.... I know that the while loop has to look a little like this >
<?php $args = array( 'post_type' => ‘themembers’, 'orderby' => 'ID', 'order' => 'DESC', 'posts_per_page' => '200' );
$i = 0;
echo ‘<tr>’;
$ourposts = new WP_Query( $args );
while($row = $ourposts) {
$img = $row['the_post_thumbnail'];
$img_link = $row['the_permalink’];
if $img = ( $i % 2 == 0 );
echo '<td><a href=\">’; $img_link; echo '\">'; $img; echo ‘</a>’; } ?>
<?php endif;
echo '<tr>';
endwhile;
?>
Is this even close ? Am I on the right track ????? I”m just guessing above….help.
Are there any code examples out there as to specifically HOW to do this ?
Any pointers would be helpful.