Don't show 'uncategorized' as a post category if it's the only category
authorLaury GvR <laury@gaslightmedia.com>
Wed, 18 Apr 2018 16:07:48 +0000 (12:07 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 18 Apr 2018 16:07:48 +0000 (12:07 -0400)
front-page.php
home.php

index fc5c1d3..9ac60fd 100644 (file)
@@ -17,7 +17,7 @@
                 <div class="row blocks">
                     <?php get_template_part('parts/glm-blocks');?>
                 </div>
-    </div>
+            </div>
             <div id="video" class="small-12 columns">
                 <div class="row">
                     <div class="video-img small-12 medium-3 large-3 columns">
index 0dd1509..b9d89ca 100644 (file)
--- a/home.php
+++ b/home.php
                         <footer class="entry-meta small-12 medium-6 medium-push-3 center">
                             <?php $post_categories = wp_get_post_categories( get_the_ID() );
                             $cats = array();
-                            echo 'This entry was posted ';
-                            if (has_category()) {
-                                echo 'in';
+                            if (has_category() && !( count( $cats ) == 1 && $cats[0]->slug == 'uncategorized' ) ) {
+                                echo 'This entry was posted in';
                                 foreach($post_categories as $c){
                                     $cat = get_category( $c );
-                                    $cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug );
-                                    echo ', <a rel="category" title="View all posts in '. $cat->name . ' " href="'. $cat->slug .'">'. $cat->name .'</a>';
+                                    if ( $cat->slug !== 'uncategorized' ) {
+                                        $cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug );
+                                        echo ', <a rel="category" title="View all posts in '. $cat->name . ' " href="'. $cat->slug .'">'. $cat->name .'</a>';
+                                    }
                                 }
                                 echo '.';
                             }