Test for last count
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Oct 2017 16:08:59 +0000 (12:08 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 31 Oct 2017 16:08:59 +0000 (12:08 -0400)
If last post then add class end to grid.

sections/landing-page.php

index ce6d966..863857b 100644 (file)
                 } else {
                     $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_parent), 'glm-block-image');
                 }
+                if (($parent->current_post +1) == ($parent->post_count)){
+                    $end = ' end ';
+                } else {
+                    $end = '';
+                }
            ?>
 
-            <div id="<?php the_ID(); ?>" class="text-center small-12 medium-4 columns large-text-left glm-block">
+            <div id="<?php the_ID(); ?>" class="text-center small-12 medium-4 columns large-text-left glm-block<?php echo $end;?>">
                 <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>