Blog sections fixed & use cats instead of tags for entity
authorLaury GvR <laury@gaslightmedia.com>
Wed, 1 Nov 2017 19:17:15 +0000 (15:17 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 1 Nov 2017 19:17:15 +0000 (15:17 -0400)
Blog sections were separated into their respective entities using
tags, so that categories could still be used, and because we never
use tags anyway. This is now changed so that categories are used
to separate posts into their sections.

Blog sections now also use advanced excerpts, instead of displaying
the full posts.

index.php
parts/blog-content-area.php
parts/blog-sidebar-r.php
parts/blog-text.php

index 5e67f72..6bc20a6 100644 (file)
--- a/index.php
+++ b/index.php
             $GLOBALS['entity_page_slug'] = get_entity_template();
             $interior = "interior";
         } else {
-            if (has_tag('government', $post)) {
+            if (has_category('government', $post)) {
                 $GLOBALS['entity_page_slug'] = 'government';
-            } else if (has_tag('chamber-of-commerce', $post)) {
+            } else if (has_category('chamber-of-commerce', $post)) {
                 $GLOBALS['entity_page_slug'] = 'chamber-of-commerce';
-            } else if (has_tag('edc', $post)) {
+            } else if (has_category('edc', $post)) {
                 $GLOBALS['entity_page_slug'] = 'edc';
-            } else if (has_tag('convention-visitors-bureau', $post)) {
+            } else if (has_category('convention-visitors-bureau', $post)) {
                 $GLOBALS['entity_page_slug'] = 'convention-visitors-bureau';
             } else {
                 $GLOBALS['entity_page_slug'] = 'default';
index a0d1d4b..4bb7ff7 100644 (file)
@@ -1,6 +1,6 @@
         <div id="blog-posts-over" class="small-12 medium-9 columns">
-            <?php $tag_query = new WP_Query( 'tag='.$GLOBALS['entity_page_slug'] ); ?>
-            <?php if($tag_query->have_posts()) : while($tag_query->have_posts()): $tag_query->the_post();?>
+            <?php $cat_query = new WP_Query( 'category_name='.$GLOBALS['entity_page_slug'] ); ?>
+            <?php if($cat_query->have_posts()) : while($cat_query->have_posts()): $cat_query->the_post();?>
             <div class="row content blog-posts-container">
               <!--  <div class="small-11 small-centered columns"> -->
                 <?php $thumbnail = get_the_post_thumbnail($post->ID, 'blog-feed-front'); ?>
index f84e105..03a10e5 100644 (file)
@@ -8,7 +8,7 @@
                 <p>Recent Posts</p>
                 <ul>
                 <?php
-                        $args = array( 'numberposts' => '5','post_status'=>'publish' );
+                        $args = array( 'numberposts' => '5', 'post_status' => 'publish', 'category_name' => $GLOBALS['entity_page_slug'] );
                         $recent_posts = wp_get_recent_posts( $args );
                         foreach( $recent_posts as $recent ){
                                 echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   $recent["post_title"].'</a> </li> ';
                     );
                   $categories = get_categories($args);
                     foreach($categories as $category) {
-                      echo '<li><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';  }
+                        if ($category->slug == $GLOBALS['entity_page_slug']) { // Make current item bold
+                            echo '<li><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '><b>' . $category->name.'</b></a> </li> ';  
+                        } else {
+                            echo '<li><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';  
+                        }
+                    }
                     ?>
                 </ul>
                 <p>Archive</p>
index 27bfe00..a05fd81 100644 (file)
@@ -9,6 +9,5 @@
                                                         <span class="meta date">Posted on <?php the_time('F jS, Y') ?></span>
                                                         <?php get_template_part('parts/share-this'); ?>
                                                     </header>
-
-                                                    <?php echo the_content(); ?>
+                                                    <?php the_advanced_excerpt('length=250&length_type=characters&no_custom=1&ellipsis=%26hellip;&exclude_tags=a,img,p,div,h1,h2,h3,h4,h5,h6'); ?>
                                                 </article>
\ No newline at end of file