more updates on blocks
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Oct 2017 16:01:43 +0000 (12:01 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Oct 2017 16:01:43 +0000 (12:01 -0400)
testing out something for the block output for sub pages.

sections/landing-page.php

index 9fdd4ed..c48ac7e 100644 (file)
             <div class="row">
                 <?php get_template_part('parts/main-content');?>
             </div>
+        </div>
+    </div>
 
-        <div data-equalizer data-options="equalize_on_stack: false">
-            <div class="glm-blocks-container row">
-            <?php
-            global $post;
-            $args = array(
-                'post_type'      => 'page',
-                'posts_per_page' => -1,
-                'post_parent'    => $post->ID,
-                'order'          => 'ASC',
-                '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 $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');
-                    } else {
-                        $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_parent), 'glm-block-image');
-                    }
-               ?>
+    <div data-equalizer data-options="equalize_on_stack: false">
+        <div class="glm-blocks-container row">
+        <?php
+        global $post;
+        $args = array(
+            'post_type'      => 'page',
+            'posts_per_page' => -1,
+            'post_parent'    => $post->ID,
+            'order'          => 'ASC',
+            'orderby'        => 'menu_order',
+            'post_status'    => 'publish',
+        );
 
-                <div id="<?php the_ID(); ?>" class="text-center small-12 medium-4 columns large-text-left glm-block">
-                       <a class="glm-block-image" href="<?php echo get_permalink($id); ?>">
-                        <img src="<?php echo $image_data[0]; ?>" />
-                       </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; ?>
+        $post_parent = $post->ID;
+        $parent = new WP_Query( $args );
+        $blockCount = 0;
+        ?>
+        <?php if ( $parent->have_posts() ) : ?>
+         <?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
+        <?php $blockCount++; ?>
+           <?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');
+                } else {
+                    $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_parent), 'glm-block-image');
+                }
+           ?>
 
-            <?php endif; wp_reset_query(); ?>
-                </div>
+            <div id="<?php the_ID(); ?>" class="text-center small-12 medium-4 columns large-text-left glm-block">
+                <a class="glm-block-image" href="<?php echo get_permalink($id); ?>"><img src="<?php echo $image_data[0]; ?>" /></a>
+                <a class="glm-block-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h1><?php the_title(); ?></h1></a>
             </div>
+        <?php if ( $blockCount % 3 ) { ?>
+        </div><div class="glm-blocks-container row">
+        <?php } ?>
+        <?php endwhile; ?>
 
+        <?php endif; wp_reset_query(); ?>
         </div>
     </div>
+
 </main>