Some fixes for the blog feed. Including frontpage
authorLaury GvR <laury@gaslightmedia.com>
Wed, 10 Jun 2015 15:04:23 +0000 (11:04 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 10 Jun 2015 15:09:37 +0000 (11:09 -0400)
front-page.php
page.php
parts/blog-feed.php

index e2dd2d2..fa49ac2 100644 (file)
@@ -5,40 +5,22 @@
     </div>
     <div class="shadow-wrapper">
         <div class="content-wrapper">
-            <div class="row">
-                <div class="small-12 columns" id="homeContent">
-                    <?php if(have_posts()) : while(have_posts()): the_post();?>
-                    <?php the_content();?>
-                    <?php endwhile; else:?>
-                    <p><?php _e('Sorry, no posts yet');?></p>
-                    <?php endif;?>
+                    <div class="row">
+                        <div class="small-12 columns">
+                            <?php if(have_posts()) : while(have_posts()): the_post();?>
+                            <?php the_content();?>
+                            <?php endwhile; else:?>
+                            <p><?php _e('Sorry, no posts yet');?></p>
+                            <?php endif;?>
+                        </div>
+                    </div>
                 </div>
-            </div>
-        </div>
     </div>
     <div class="row">
         <div id="blog-feed" class="small-12 large-9 columns">
             <div class="shadow-wrapper">
                 <div class="content-wrapper">
-                    <div class="row wordpress-content">
-                        <h1>Upcoming Events</h1>
-                        <?php
-                        $args = array( 'numberposts' => 3);
-                        $lastposts = get_posts( $args );
-                        foreach($lastposts as $post) : setup_postdata($post); ?>
-                            <div class="small-12 columns">
-                                <?php $thumbnail = get_the_post_thumbnail($post->ID, array(120, 100)); ?>
-                                <?php if ($thumbnail):?>
-                                    <div class="wp-caption alignleft">
-                                        <?php echo $thumbnail; ?>
-                                    </div>
-                                <?php endif;?>
-                                <h2><a class="read" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
-                                <p><?php echo the_advanced_excerpt('length=75&length_type=words&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong'); ?></p>
-                                <a class="read" href="<?php the_permalink(); ?>">read more...</a>
-                            </div>
-                        <?php endforeach; ?>
-                    </div>
+                    <?php get_template_part("parts/blog-feed");?>
                 </div>
             </div>
         </div>
index a503087..0c7277c 100644 (file)
--- a/page.php
+++ b/page.php
@@ -9,13 +9,19 @@
                         <div class="small-12 columns">
                             <?php if(have_posts()) : while(have_posts()): the_post();?>
                             <?php the_content();?>
-
                             <?php endwhile; else:?>
                             <p><?php _e('Sorry, no posts yet');?></p>
                             <?php endif;?>
                         </div>
                     </div>
-                    <?php get_template_part('parts/blog-feed'); ?>
+                </div>
+            </div>
+            
+            <div id="blog-feed">
+                <div class="shadow-wrapper">
+                    <div class="content-wrapper">
+                        <?php get_template_part("parts/blog-feed");?>
+                    </div>
                 </div>
             </div>
         </div>
index a7e6f76..0998199 100644 (file)
@@ -1,25 +1,35 @@
-<?php if (is_page(array("events","recreation","sailing","tennis","activities","beach"))) { ?>
-<div class="row wordpress-content">
-    <h1>Upcoming Events</h1>
+<?php 
+if (is_page(array("events","recreation","sailing","tennis","activities","beach"))) { 
+    $cat_name = get_query_var('name');
+} else if (is_front_page()) { 
+    $cat_name = "Home Page";
+} else {
+    $cat_name = "";
+}
+?>
+
     <?php
-    $args = array( 'category_name' => get_query_var('name'),'numberposts' => 3, 'order_by' => 'date');
+    $args = array( 'category_name' => $cat_name,'numberposts' => 3, 'order_by' => 'date');
     $lastposts = get_posts( $args );
-    foreach($lastposts as $post) : setup_postdata($post); ?>
-        <div class="small-12 columns">
-            <?php $thumbnail = get_the_post_thumbnail($post->ID, array(130, 130)); ?>
-            <?php if ($thumbnail) {?>
-                <div class="small-3 columns blog-feed-image">
-                        <?php echo $thumbnail; ?>
+    if ($lastposts) { ?>
+        <div class="row wordpress-content">
+        <h1>Upcoming Events</h1>
+        <?php foreach($lastposts as $post) : setup_postdata($post); ?>
+            <div class="small-12 columns">
+                <?php $thumbnail = get_the_post_thumbnail($post->ID, array(130, 130)); ?>
+                <?php if ($thumbnail) { ?>
+                    <div class="small-3 columns blog-feed-image">
+                            <?php echo $thumbnail; ?>
+                    </div>
+                    <div class="small-9 columns blog-feed-text">
+                <?php } else { ?>
+                    <div class="small-12 columns blog-feed-text">
+                <?php } ?>
+                <h2><a class="read" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
+                <p><?php echo the_advanced_excerpt('length=75&length_type=words&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong'); ?></p>
+                <a class="read" href="<?php the_permalink(); ?>">read more...</a>
                 </div>
-                <div class="small-9 columns blog-feed-text">
-            <?php } else { ?>
-                <div class="small-12 columns blog-feed-text">
-            <?php } ?>
-            <h2><a class="read" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
-            <p><?php echo the_advanced_excerpt('length=75&length_type=words&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong'); ?></p>
-            <a class="read" href="<?php the_permalink(); ?>">read more...</a>
             </div>
+        <?php endforeach; ?>
         </div>
-    <?php endforeach; ?>
-</div>
-<?php } ?>
\ No newline at end of file
+    <?php } ?>
\ No newline at end of file