Use php to setup every third in row
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Oct 2017 15:57:26 +0000 (11:57 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Oct 2017 15:57:26 +0000 (11:57 -0400)
Put a new row for every third block.

sections/landing-page.php

index 4d7fad4..9fdd4ed 100644 (file)
             <div class="row">
                 <?php get_template_part('parts/main-content');?>
             </div>
-<style>
-.glm-blocks-container .glm-block:nth-child(4n+4) {
-    clear: left;
-}
-</style>
 
         <div data-equalizer data-options="equalize_on_stack: false">
             <div class="glm-blocks-container row">
                 'posts_per_page' => -1,
                 'post_parent'    => $post->ID,
                 'order'          => 'ASC',
-                'orderby'        => 'menu_order'
+                'orderby'        => 'menu_order',
+                'post_status'    => 'publish',
             );
 
             $post_parent = $post->ID;
             $parent = new WP_Query( $args );
+            $blockCount = 1;
             ?>
             <?php if ( $parent->have_posts() ) : ?>
              <?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
-              <?php $status = get_post_status(); ?>
-              <?php if ($status !== 'private' && $status !== 'draft'){ ?>
                <?php $id = get_the_ID();
                     if(get_post_thumbnail_id($id)){
                         $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'glm-block-image');
                        </a>
                     <a class="glm-block-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h1><?php the_title(); ?></h1></a>
                 </div>
+            <?php ++$blockCount; ?>
+            <?php if ( $blockCount % 3 ) { ?>
+            </div>
+            <div class="glm-blocks-container row">
             <?php } ?>
             <?php endwhile; ?>