Update blog feed
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 9 Nov 2015 21:51:00 +0000 (16:51 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 9 Nov 2015 21:51:00 +0000 (16:51 -0500)
adding ability to display these blog feeds also to specific pages.

front-page.php
page.php
parts/blog-feed.php

index 862800b..d042f6e 100644 (file)
@@ -3,33 +3,7 @@
 <main>
     <div class="row" data-equalizer data-options="equalize_on_stack: false">
         <div id="front" class="small-12 medium-7 large-8 columns" data-equalizer-watch>
-            <h1>EMMET COUNTY NEWS</h1>
-            <div id="home-feed-posts">
-            <?php
-            $args = array( 'numberposts' => 3);
-            $lastposts = get_posts( $args );
-            foreach($lastposts as $post) : setup_postdata($post); ?>
-                <div class="home-feed-post">
-
-                    <div class="row">
-                        <?php if (has_post_thumbnail( $post->ID )) { ?>
-                        <div class="small-8 small-centered medium-3 medium-uncentered columns home-feed-post-image">
-                            <?php echo get_the_post_thumbnail($post->ID, array(190, 190), array('class' => 'blog-excerpt-img-wrap')); ?>
-                            </div>
-                            <div class="small-12 medium-9 columns home-feed-post-content">
-                             <?php } else { ?>
-                            <div class="small-12 columns home-feed-post-content">
-                            <?php } ?>
-                            <h2 class="title-posts" href="<?php the_permalink(); ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
-
-<!--                            <p id="date" class="italic"><?php // echo get_the_date('D, F j, Y g:iA', $post->ID); ?></p>-->
-
-                            <div><?php echo the_advanced_excerpt('length=95&length_type=characters&no_custom=1&ellipsis=%26hellip;&exclude_tags=a,img,p,strong,h1,h2,h3,hr,div'); ?></div>
-                        </div>
-                    </div>
-                </div>
-            <?php endforeach; ?>
-            </div>
+            <?php get_template_part('parts/blog-feed')?>
             <div class="row collapse">
                 <?php if(have_posts()) : while(have_posts()): the_post();?>
                 <?php the_content();?>
@@ -37,9 +11,7 @@
                 <p><?php _e('Sorry, no posts yet');?></p>
                 <?php endif;?>
                 <div class="row blocks">
-                    <?php
-                    get_template_part('parts/glm-blocks');
-                    ?>
+                    <?php get_template_part('parts/glm-blocks');?>
                 </div>
 <!--
                 <div id="video" class="small-12 columns">
index 12ed4de..e8960c7 100644 (file)
--- a/page.php
+++ b/page.php
@@ -1,6 +1,6 @@
 <?php get_header(); ?>
                 <main class="page-inside">
-                    <div class="row" data-equalizer>   
+                    <div class="row" data-equalizer>
                         <?php if ( is_page('event-calendar') ) { ?>
                             <div id="content-bulk" class="small-12 medium-10 medium-centered columns">
                         <?php } else { ?>
@@ -9,9 +9,7 @@
                         <?php } ?>
                             <div id="con" class="row">
                                 <div class="small-12 columns">
-                                    <?php
-                                    get_template_part('parts/bread-crumbs');
-                                    ?>
+                                    <?php get_template_part('parts/bread-crumbs');?>
                                     <?php if(have_posts()) : while(have_posts()): the_post();?>
                                     <?php the_content();?>
                                     <?php endwhile; else:?>
@@ -19,6 +17,7 @@
                                     <?php endif;?>
                                 </div>
                             </div>
+                            <?php get_template_part('parts/blog-feed')?>
                             <footer>
                                 <div class="small-12 small-text-center columns">
                                     <img src="<?php echo get_template_directory_uri(); ?>/assets/slogan.png">
index 9802084..9a51d5d 100644 (file)
@@ -1,28 +1,39 @@
-    <?php
-    $args = array('numberposts' => 3, 'order_by' => 'date');
-    $lastposts = get_posts( $args );
-    if ($lastposts) { ?>
-
-            <div class="content-wrapper">
-                <div class="row wordpress-content">
-                <?php foreach($lastposts as $post) : setup_postdata($post); ?>
-                    <div class="small-12 columns blog-feed-post">
-                        <?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 id="date" class="italic"><?php echo get_the_date('D, F j, Y g:iA', $post->ID); ?></p>
-                        
-                        <p><?php echo the_advanced_excerpt('length=200&length_type=characters&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong'); ?></p>
-                        </div>
-                    </div>
-                <?php endforeach; ?>
+<?php
+if (is_front_page()) {
+    $args = array( 'numberposts' => 3);
+} else if (is_page(11783)) { // Prosecuting Attorney
+    $args = array( 'numberposts' => 3, 'category' => 17);
+} else if (is_page(11769)) { // Veterans Affairs
+    $args = array( 'numberposts' => 3, 'category' => 19);
+} else if (is_page(6963)) { // Veterans Stories
+    $args = array( 'numberposts' => 3, 'category' => 68);
+} else if (is_page(11786)) { // Parks and Rec
+    $args = array( 'numberposts' => 3, 'category' => 26);
+} else if (is_page(1257)) { // Sheriff
+    $args = array( 'numberposts' => 3, 'category' => 18);
+} else {
+    return;
+}
+?>
+<h1>EMMET COUNTY NEWS</h1>
+<div id="home-feed-posts">
+<?php
+$lastposts = get_posts( $args );
+foreach($lastposts as $post) : setup_postdata($post); ?>
+    <div class="home-feed-post">
+        <div class="row">
+            <?php if (has_post_thumbnail( $post->ID )) { ?>
+            <div class="small-8 small-centered medium-3 medium-uncentered columns home-feed-post-image">
+                <?php echo get_the_post_thumbnail($post->ID, array(190, 190), array('class' => 'blog-excerpt-img-wrap')); ?>
                 </div>
+                <div class="small-12 medium-9 columns home-feed-post-content">
+                 <?php } else { ?>
+                <div class="small-12 columns home-feed-post-content">
+                <?php } ?>
+                <h2 class="title-posts" href="<?php the_permalink(); ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
+                <div><?php echo the_advanced_excerpt('length=95&length_type=characters&no_custom=1&ellipsis=%26hellip;&exclude_tags=a,img,p,strong,h1,h2,h3,hr,div'); ?></div>
             </div>
-    <?php } ?>
\ No newline at end of file
+        </div>
+    </div>
+<?php endforeach; ?>
+</div>