小编Ant*_*ida的帖子

使用div将自定义wordpress循环中的每4个帖子换行

    <?php
      $args = array(
      'post_type' => 'college',
      'posts_per_page' => -1,
      'order' => 'DESC',
      'orderby' => 'menu_order'
      );

      $the_query = new WP_Query( $args );
      if ( $the_query->have_posts() ) :
      while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

      <div class="col-3">
        <?php the_title(); ?>
      </div>

   <?php
   endwhile;
   endif;
   wp_reset_postdata();
   ?>
Run Code Online (Sandbox Code Playgroud)

嗨,我以前从未这样做过.我试图在上面的循环中包装每4个帖子<div class="row"></div>

php wordpress loops row

3
推荐指数
1
解决办法
2937
查看次数

标签 统计

loops ×1

php ×1

row ×1

wordpress ×1