From 5051cc8717fab3ce3d2ddd93da195bb05c6c33f1 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Wed, 16 Aug 2017 12:46:38 -0400 Subject: [PATCH] Post tag check for entity templates Post tags are now checked to determine which entity template to use. Blog home now shows only posts with relevant tags. --- index.php | 28 +++++++++++++++++----------- parts/blog-content-area.php | 4 +++- parts/blog-text.php | 10 +++++----- sidebar.php | 17 ----------------- 4 files changed, 25 insertions(+), 34 deletions(-) diff --git a/index.php b/index.php index d47b1f7..835dfad 100644 --- a/index.php +++ b/index.php @@ -8,13 +8,23 @@ } else if ( get_entity_template() ) { $GLOBALS['entity_page_slug'] = get_entity_template(); } else { - $GLOBALS['entity_page_slug'] = 'default'; + if (has_tag('government', $post)) { + $GLOBALS['entity_page_slug'] = 'government'; + } else if (has_tag('chamber-of-commerce', $post)) { + $GLOBALS['entity_page_slug'] = 'chamber-of-commerce'; + } else if (has_tag('edc', $post)) { + $GLOBALS['entity_page_slug'] = 'edc'; + } else if (has_tag('convention-visitors-bureau', $post)) { + $GLOBALS['entity_page_slug'] = 'convention-visitors-bureau'; + } else { + $GLOBALS['entity_page_slug'] = 'default'; + } } // get_entity_template returns current page slug if current page is entity page // returns parent entity page slug if child of entity page // returns false if top-level non-entity - ?> + ?>
@@ -26,19 +36,15 @@ include "sections/front-page.php"; } else { include "sections/header.php"; - if (is_home()) { + if (is_home() || is_page($GLOBALS['entity_page_slug']."-news")) { include "sections/blog-home.php"; - } - if (is_archive()) { + } else if (is_archive()) { include "sections/blog-archive.php"; - } - if (is_single()) { + } else if (is_single()) { include "sections/blog-single.php"; - } - if (is_search()) { + } else if (is_search()) { include "sections/search.php"; - } - if (is_page() && !is_front_page()) { + } else if (is_page() && !is_front_page()) { if(is_entity_landing_page()) { include __DIR__.'/sections/entity-landing.php'; } else { diff --git a/parts/blog-content-area.php b/parts/blog-content-area.php index 66c0dd3..bcdcfbe 100644 --- a/parts/blog-content-area.php +++ b/parts/blog-content-area.php @@ -1,5 +1,7 @@
- + + + have_posts()) : while($tag_query->have_posts()): $tag_query->the_post();?>
ID, 'blog-feed-front'); ?> diff --git a/parts/blog-text.php b/parts/blog-text.php index 342dfa1..27bfe00 100644 --- a/parts/blog-text.php +++ b/parts/blog-text.php @@ -1,14 +1,14 @@
>
-

+

- - - + + + Posted on
- +
\ No newline at end of file diff --git a/sidebar.php b/sidebar.php index ba76897..fe719cb 100644 --- a/sidebar.php +++ b/sidebar.php @@ -1,20 +1,3 @@ -