Entity_page_slug made part of GLOBALS array to allow access in slideshow.php included...
authorLaury GvR <laury@gaslightmedia.com>
Thu, 27 Jul 2017 18:26:59 +0000 (14:26 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 27 Jul 2017 18:26:59 +0000 (14:26 -0400)
index.php
lib/header.php
parts/header-meta.php
parts/slide-show.php [deleted file]
parts/slideshow.php [new file with mode: 0644]
sections/entity-interior.php
sections/entity-landing.php
sections/front-page.php
sections/top-bar.php

index 2c23ea8..0400b7c 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,13 +1,16 @@
 <!doctype html>
 <html class="no-js" lang="en">
     <?php get_template_part("parts/header-meta"); ?>
-    <?php $index_template = true;
-    if ( get_abs_parent() ) {
-    $entity_page = get_post(get_abs_parent());
-    } else {
-        $entity_page = get_post($post->ID);
-    }
-    $entity_page_slug = $entity_page->post_name; ?>
+    <?php
+        $index_template = true;
+        if ( get_abs_parent() ) {
+            $entity_page = get_post(get_abs_parent());
+        } else {
+            $entity_page = get_post($post->ID);
+        }
+
+        $GLOBALS['entity_page_slug'] = $entity_page->post_name;
+    ?>
     <body>
         <div class="off-canvas-wrapper">
             <div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
 
                             if(get_abs_parent()){
                                 // If I have an entity landing page as parent, I must be an entity interior page
-                                get_template_part('sections/entity-interior');
+                                include __DIR__.'/sections/entity-interior.php';
                             } else {
                                 // If not, and I am clearly not frontpage (checked above), I must be an entity landing page
-                                get_template_part('sections/entity-landing');
+                                include __DIR__.'/sections/entity-landing.php';
                             }
                         }
                     }
index c091add..b74d33f 100644 (file)
@@ -1,18 +1,24 @@
 <?php
 /* Header for posts*/
 function glm_get_header() {
-    echo '<div';
-    if ( has_post_thumbnail()  ) {
-            $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
-            echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:20%;background-position: center center;background-size: 100%;background-repeat:no-repeat;max-height: 350px; "';
+    if ( !get_abs_parent() ) { // is an entity landing page
+        echo "<div id=\"slide\">";
+        include __DIR__.'/../parts/slideshow.php';
+        echo "</div>";
     } else {
-            echo ' style="background-image: url('.get_template_directory_uri().'/assets/header-image.jpg);height:0;padding:0;padding-bottom:30%;background-position: center center;background-size: 100%;background-repeat:no-repeat;max-height: 500px;"';
-            echo ' class="no-featured"';
+        echo '<div';
+        if ( has_post_thumbnail()  ) {
+                $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
+                echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:20%;background-position: center center;background-size: 100%;background-repeat:no-repeat;max-height: 350px; "';
+        } else {
+                echo ' style="background-image: url('.get_template_directory_uri().'/assets/header-image.jpg);height:0;padding:0;padding-bottom:30%;background-position: center center;background-size: 100%;background-repeat:no-repeat;max-height: 500px;"';
+                echo ' class="no-featured"';
+        }
+        echo '>';
+        echo '</div>';
+        echo '<div class="row">';
+        echo '<div class="small-12 columns">';
+        echo '</div>';
+        echo '</div>';
     }
-    echo '>';
-    echo '</div>';
-    echo '<div class="row">';
-    echo '<div class="small-12 columns">';
-    echo '</div>';
-    echo '</div>';
 }
\ No newline at end of file
index 1119c39..1401329 100644 (file)
@@ -4,7 +4,7 @@
     <title><?php wp_title(); ?></title>
 <!--    <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">-->
     <link href="https://fonts.googleapis.com/css?family=Roboto+Slab:400,700" rel="stylesheet">
-     <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" rel="stylesheet"> 
+     <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" rel="stylesheet">
     <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri() ; ?>/css/app.css">
 <!--    <link rel="shortcut icon" href="<?php //echo bloginfo('template_url'); ?>/favicon.ico">-->
     <?php wp_head(); ?>
diff --git a/parts/slide-show.php b/parts/slide-show.php
deleted file mode 100644 (file)
index 3bbffd7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<div id="slideshow">
-    <ul>
-        <?php
-            switch($entity_page_slug){
-                case "government":
-                    if ( is_active_sidebar( 'government-slideshow' ) ) {
-                        dynamic_sidebar( 'government-slideshow' );
-                    }
-                    break;
-                case "chamber-of-commerce":
-                    if ( is_active_sidebar( 'chamber-slideshow' ) ) {
-                        dynamic_sidebar( 'chamber-slideshow' );
-                    }
-                    break;
-                case "convention-visitors-bureau":
-                    if ( is_active_sidebar( 'cvb-slideshow' ) ) {
-                        dynamic_sidebar( 'cvb-slideshow' );
-                    }
-                    break;
-                case "edc":
-                    if ( is_active_sidebar( 'edc-slideshow' ) ) {
-                        dynamic_sidebar( 'edc-slideshow' );
-                    }
-                    break;
-                default:
-                    if ( is_active_sidebar( 'main-slideshow' ) ) {
-                        dynamic_sidebar( 'main-slideshow' );
-                    }
-                    break;
-            }
-        ?>
-        <?php // do_action('slideshow_deploy', '20'); ?>
-
-    </ul>
-</div>
diff --git a/parts/slideshow.php b/parts/slideshow.php
new file mode 100644 (file)
index 0000000..6b269b3
--- /dev/null
@@ -0,0 +1,35 @@
+<div id="slideshow">
+    <ul>
+        <?php
+            switch($GLOBALS['entity_page_slug']){
+                case "government":
+                    if ( is_active_sidebar( 'government-slideshow' ) ) {
+                        dynamic_sidebar( 'government-slideshow' );
+                    }
+                    break;
+                case "chamber-of-commerce":
+                    if ( is_active_sidebar( 'chamber-slideshow' ) ) {
+                        dynamic_sidebar( 'chamber-slideshow' );
+                    }
+                    break;
+                case "convention-visitors-bureau":
+                    if ( is_active_sidebar( 'cvb-slideshow' ) ) {
+                        dynamic_sidebar( 'cvb-slideshow' );
+                    }
+                    break;
+                case "edc":
+                    if ( is_active_sidebar( 'edc-slideshow' ) ) {
+                        dynamic_sidebar( 'edc-slideshow' );
+                    }
+                    break;
+                default:
+                    if ( is_active_sidebar( 'main-slideshow' ) ) {
+                        dynamic_sidebar( 'main-slideshow' );
+                    }
+                    break;
+            }
+        ?>
+        <?php // do_action('slideshow_deploy', '20'); ?>
+
+    </ul>
+</div>
index 1920542..57cec4f 100644 (file)
@@ -1,6 +1,6 @@
 <main class="page-inside entity-interior">
     <div id="content-wrapper">
-        <?php echo glm_get_header();?>
+        <?php glm_get_header();?>
          <?php $sidebar = get_field('sidebar'); ?>
          <?php $template = get_page_template_slug($post->ID); ?>
           <div class="row column">
index 6907057..0c62fc0 100644 (file)
@@ -1,6 +1,6 @@
 <main class="page-inside entity-landing">
     <div id="content-wrapper">
-        <?php echo glm_get_header();?>
+        <?php glm_get_header();?>
          <?php //$post_content = get_post($post->ID); ?>
           <div class="row column">
                     <?php if(!is_front_page()) {
index fd3b17b..86efaed 100644 (file)
@@ -1,6 +1,6 @@
 <main class="page-front">
     <div id="slide">
-        <?php get_template_part('parts/slide-show');?>
+       <?php include __DIR__.'/../parts/slideshow.php'; ?>
     </div>
     <div id="content-wrapper">
         <div id="block-row">
index ed1d677..828cb46 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-if( in_array(get_page_template(), page_templates()) || in_array($entity_page_slug,get_landing_pages()) ){ ?>
+if( in_array(get_page_template(), page_templates()) || in_array($GLOBALS['entity_page_slug'],get_landing_pages()) ){ ?>
     <div id="interior-menu" class="show-for-large">
         <div class="top-bar">
             <div class="top-bar-left">
@@ -9,7 +9,7 @@ if( in_array(get_page_template(), page_templates()) || in_array($entity_page_slu
             <div class="top-bar-left">
 <?php }
 
-    switch($entity_page_slug){
+    switch($GLOBALS['entity_page_slug']){
         case "government":
             glm_theme_gov_navigation();
             break;