County landing and sub page functionality integrated into interior template
authorLaury GvR <laury@gaslightmedia.com>
Sun, 10 Feb 2019 21:02:15 +0000 (16:02 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Sun, 10 Feb 2019 21:02:15 +0000 (16:02 -0500)
county-landing-page-template.php [deleted file]
county-page-template.php [new file with mode: 0644]
county-sub-page-template.php [deleted file]
functions.php
landing-page.php [deleted file]
sections/interior-page.php
sidebar.php

diff --git a/county-landing-page-template.php b/county-landing-page-template.php
deleted file mode 100644 (file)
index 0a65909..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-/*
-Template Name: County Landing Page Template
-*/
-get_template_part('index');
\ No newline at end of file
diff --git a/county-page-template.php b/county-page-template.php
new file mode 100644 (file)
index 0000000..223caca
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+/*
+Template Name: County Page Template
+*/
+get_template_part('index');
\ No newline at end of file
diff --git a/county-sub-page-template.php b/county-sub-page-template.php
deleted file mode 100644 (file)
index e13f53d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-/*
-Template Name: County Sub Page Template
-*/
-get_template_part('index');
\ No newline at end of file
index cef47d3..5936947 100644 (file)
@@ -8,8 +8,8 @@ $frontPageId  = get_option('page_on_front');
 add_action('widgets_init', 'glm_quicksite_widget_init');
 add_action('widgets_init', 'glm_weather_widget_init');
 
-define('GLM_BLOCKS_FOOTER_GROUP_ID', "8213"); // L: 8249, A: , dev70: 8213
-define('COUNTIES_PAGE_ID', "169"); // L: 8249, A: , dev70: 8213
+define('GLM_BLOCKS_FOOTER_GROUP_ID', "8249"); // L: 8249, A: , dev70: 8213
+define('COUNTIES_PAGE_ID', "169");
 
 if (!function_exists('glm_quicksite_widget_init')) {
 
@@ -387,15 +387,16 @@ add_filter(
 function get_county_page_id() {
     global $post;
     $countyPageId = false;
-
-    if ( $post->ID == COUNTIES_PAGE_ID ) {
-        // I'm the counties page
-    } else if ( wp_get_post_parent_id( $post ) == COUNTIES_PAGE_ID ) {
-        // I'm a county page
-        $countyPageId = $post->ID;
-    } else {
-        // I'm a child of a county page
-        $countyPageId = wp_get_post_parent_id( $post );
+    if ( is_in_tree( COUNTIES_PAGE_ID ) ) {
+        if ( $post->ID == COUNTIES_PAGE_ID ) {
+            // I'm the counties page
+        } else if ( wp_get_post_parent_id( $post ) == COUNTIES_PAGE_ID ) {
+            // I'm a county page
+            $countyPageId = $post->ID;
+        } else {
+            // I'm a child of a county page
+            $countyPageId = wp_get_post_parent_id( $post );
+        }
     } 
 
     return $countyPageId;
diff --git a/landing-page.php b/landing-page.php
deleted file mode 100644 (file)
index cc431b2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-/*
-Template Name: Landing Page
-*/
-get_template_part('index');
\ No newline at end of file
index aefcdda..3b76d89 100644 (file)
 ?>
 <main class="page-inside <?php echo $template ?: 'default-template';?>>
     <?php if ( is_in_tree( COUNTIES_PAGE_ID ) ) { ?>
-        <?php if ( $post->ID == COUNTIES_PAGE_ID ) { ?>
-            <?php 
-                // I'm the counties page
-                // $debugMsg[] = "I'm the counties page";
-                $isCountiesPage = true;
-            ?>
-        <?php } else if ( wp_get_post_parent_id( $post ) == COUNTIES_PAGE_ID ) { ?>
-            <?php 
-                // I'm a county page
-                // $debugMsg[] = "I'm a county page";
-                $isCountyLandingPage = true;
-                $countyPageId = $post->ID;
-            ?>
-        <?php } else { ?>
-            <?php
-                // I'm a child of a county page
-                // $debugMsg[] = "I'm a child of a county page";
-                $isCountyChildPage = true;
-                $countyPageId = wp_get_post_parent_id( $post );
-                $debugMsg[] = "post: " . get_the_title($post->ID);
-            ?>
-        <?php } ?>
-        
+
         <?php 
             $countyPageId = get_county_page_id();
             $countyChildren = get_county_page_children($countyPageId);
         <?php if ( $countyChildren ) {
             if(strpos(get_the_title($post->ID), 'Water') !== false ){
                 // $debugMsg[] = "I'm a waterfall page";
-                $memberCategory = '25'; // L: 3, dev70: 25
+                $memberCategory = '3'; // L: 3, dev70: 25
             } else if(strpos(get_the_title($post->ID), 'Light') !== false ){
                 // $debugMsg[] = "I'm a lighthouse page";
-                $memberCategory = '21'; // L: 4, ddev70: 21
+                $memberCategory = '4'; // L: 4, ddev70: 21
             } else {
                 // $debugMsg[] = "I'm neither waterfall nor a light house";
             }
     ?>
     
     
-    <?php if ( $post->ID == COUNTIES_PAGE_ID ) { ?>
+    <?php if ( $post->ID == COUNTIES_PAGE_ID && ( function_exists('the_field') && get_field('interior_header_crowdriff_script',$post->ID) )) { ?>
+        <div id="header-crowdriff">
+            <?php echo the_field('interior_header_crowdriff_script',$post->ID); ?>
+        </div>
+    <?php } else if (function_exists('the_field') && get_field('interior_header_crowdriff_script',$post->ID)) { ?>
         <div id="header-crowdriff">
             <?php echo the_field('interior_header_crowdriff_script',$post->ID); ?>
         </div>
                 echo do_shortcode("[glm-members-list show='-list' view='map' category='". $memberCategory ."' county-search='". $memberCountyId ."']");
             ?>
         </div>
-    <?php } else if (function_exists('the_field') && get_field('interior_header_crowdriff_script',$post->ID)) { ?>
-        <div id="header-crowdriff">
-            <?php echo the_field('interior_header_crowdriff_script',$post->ID); ?>
-        </div>
-    <?php } else { ?>
+    <?php }  else { ?>
         <div id="header-featured">
             <?php echo glm_get_header(); ?>
         </div>
                 </div>
             <?php break; ?>
 
-            <?php case "county-landing-page-template": ?>
-                <div class="row">
-                    <div class="small-12 large-8 columns" data-equalizer-watch>
-                        <?php echo the_field('top_content',$post->ID); ?>
-                        <?php echo the_field('member_db_map_shortcode',$post->ID); ?>
-                        <?php echo the_field('member_db_list_shortcode',$post->ID); ?>
-                        <?php get_template_part('parts/main-content'); ?>
-                    </div>
-                    <div class="small-12 large-4 columns">
-                        <?php get_sidebar(); ?>
-                    </div>
-                </div>
-            <?php break; ?>
-
-            <?php case "county-sub-page-template": ?>
-                <div class="row">
-                    <div class="small-12 large-8 columns" data-equalizer-watch>
-                        <?php //echo the_field('top_content',$post->ID); ?>
-                        <?php //echo the_field('member_db_map_shortcode',$post->ID); ?>
-                        <?php //echo the_field('member_db_list_shortcode',$post->ID); ?>
-                        <?php get_template_part('parts/main-content'); ?>
-                    </div>
-                    <div class="small-12 large-4 columns">
-                        <?php get_sidebar(); ?>
-                    </div>
-                </div>
-            <?php break; ?>
-
             <?php default: ?>
                 <div class="row">
-                    <div class="small-12 large-8 columns">
+                    <div class="small-12 large-8 columns" data-equalizer-watch>
                         <?php get_template_part('parts/main-content'); ?>
                     </div>
                     <div class="small-12 large-4 columns">
index 59186e7..5ee2412 100644 (file)
@@ -1,42 +1,44 @@
 <div id="sidebar" class="show-for-large-up large-4 columns">
 
-    <?php 
-        $countyPageId = get_county_page_id();
-        $countyChildren = get_county_page_children($countyPageId);
-    ?>
-    <?php if ( $countyChildren ) { ?>
+    <?php if ( is_in_tree( COUNTIES_PAGE_ID ) ) { ?>
+        <?php 
+            $countyPageId = get_county_page_id();
+            $countyChildren = get_county_page_children($countyPageId);
+        ?>
+        <?php if ( $countyChildren ) { ?>
 
-        <div id="county-buttons-container" class="row" >
-            <h2>Explore</h2>
-            <div id="county-buttons">
-                
-                <div class="image-strip" >
-                    <a class="county-button active" href="<?php echo get_permalink( $countyPageId ); ?>#about">
-                    <i class="fas fa-info-circle about-icon"></i>
-                        About
-                    </a>
-                </div>
-                <div class="image-strip">
-                    <a class="county-button active" href="<?php echo get_permalink( $countyPageId ); ?>#gallery">
-                    <i class="fas fa-images about-icon"></i>
-                        Gallery
-                    </a>
-                </div>
-                <?php foreach ( $countyChildren as $countyChild ) { ?>
-                    <?php if(strpos($countyChild['post_title'], 'Water') !== false ){
-                        $icon = 'fa-water';
-                    }else if(strpos($countyChild['post_title'], 'Light') !== false ){
-                        $icon = 'lighthouse';
-                    } ?>
-                    <div class="image-strip <?php if ($post->ID == $countyChild['ID']) { ?>active<?php } ?>">
-                        <a class="county-button" href="<?php echo get_permalink( $countyChild["ID"] );?>">
-                            <i class="fas <?php echo $icon; ?> <?php echo $icon .'-icon'; ?>"></i>
-                            <?php echo $countyChild['post_title']; ?>
+            <div id="county-buttons-container" class="row" >
+                <h2>Explore</h2>
+                <div id="county-buttons">
+                    
+                    <div class="image-strip" >
+                        <a class="county-button active" href="<?php echo get_permalink( $countyPageId ); ?>#about">
+                        <i class="fas fa-info-circle about-icon"></i>
+                            About
                         </a>
                     </div>
-                <?php } ?>
+                    <div class="image-strip">
+                        <a class="county-button active" href="<?php echo get_permalink( $countyPageId ); ?>#gallery">
+                        <i class="fas fa-images about-icon"></i>
+                            Gallery
+                        </a>
+                    </div>
+                    <?php foreach ( $countyChildren as $countyChild ) { ?>
+                        <?php if(strpos($countyChild['post_title'], 'Water') !== false ){
+                            $icon = 'fa-water';
+                        }else if(strpos($countyChild['post_title'], 'Light') !== false ){
+                            $icon = 'lighthouse';
+                        } ?>
+                        <div class="image-strip <?php if ($post->ID == $countyChild['ID']) { ?>active<?php } ?>">
+                            <a class="county-button" href="<?php echo get_permalink( $countyChild["ID"] );?>">
+                                <i class="fas <?php echo $icon; ?> <?php echo $icon .'-icon'; ?>"></i>
+                                <?php echo $countyChild['post_title']; ?>
+                            </a>
+                        </div>
+                    <?php } ?>
+                </div>
             </div>
-        </div>
+        <?php } ?>
     <?php } ?>
     <?php
         if (is_in_tree(get_option('glm_members_database_option_members_only_id'))) {?>