我对这个有点迷茫,所以我真的希望对如何将下面的代码修改成对我有用的东西有所帮助。我正在使用 CPTUI 插件,它工作正常。下面的代码片段来自我创建的修改后的有序列表。它按照应有的方式在带有缩略图的有序列表中显示页面。一切正常。但是,我想将此显示为一行三个表格单元格
这是我拥有的代码的链接> https://pastebin.com/N44fyEhB
while 循环的代码片段:
<?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; ?>
我正在寻找的是一种在单行中显示 3 列的方法......我知道 while 循环必须看起来像这样 >
<?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;
?>
这甚至接近吗?我在正确的轨道上吗??????我只是在上面猜测......帮助。
是否有任何代码示例具体说明如何执行此操作?
任何指针都会有所帮助。