Mass rework of the glmTheme in an attempt to make it a one file wonder
authorIan Weller <ian@gaslightmedia.com>
Tue, 26 Jul 2016 19:22:52 +0000 (15:22 -0400)
committerIan Weller <ian@gaslightmedia.com>
Tue, 26 Jul 2016 19:22:52 +0000 (15:22 -0400)
14 files changed:
root/archive.php [deleted file]
root/front-page.php [deleted file]
root/header.php
root/home.php [deleted file]
root/index.php
root/parts/archive.php [new file with mode: 0644]
root/parts/front-view.php [new file with mode: 0644]
root/parts/glm-kitchen-sink.php
root/parts/home.php [new file with mode: 0644]
root/parts/search-result.php [new file with mode: 0644]
root/parts/single.php [new file with mode: 0644]
root/parts/top-bar.php
root/search.php [deleted file]
root/single.php [deleted file]

diff --git a/root/archive.php b/root/archive.php
deleted file mode 100644 (file)
index 38c6c45..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php get_header(); ?>
-<main class="blog-archive">
-    <div class="row">
-        <?php get_template_part('parts/blog-content-area'); ?>
-        <?php get_template_part('parts/blog-sidebar-r'); ?>
-    </div>
-    <?php get_footer(); ?>
diff --git a/root/front-page.php b/root/front-page.php
deleted file mode 100644 (file)
index 859a190..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php get_header(); ?>
-<main class="page-front">
-    <div class="row">
-        <?php get_template_part('parts/slide-show');?>
-    </div>
-    <div id="content-wrapper">
-        <div class="row" data-equalizer data-options="equalize_on_stack: false">
-            <?php
-            get_template_part('parts/glm-blocks');
-            ?>
-        </div>
-        <div class="row">
-            <?php get_template_part('parts/main-content');?>
-<!--
-            <div class="small-12 medium-6 large-4 columns small-text-center medium-text-left">
-                <?php //get_sidebar(); ?>
-            </div>
--->
-        </div>
-    </div>
-<?php get_footer(); ?>
index 5e3e46d..b5c4af7 100644 (file)
@@ -1,3 +1,4 @@
+<?php get_template_part('parts/php-refs');?>
 <!doctype html>
 <html class="no-js" lang="en">
   <head>
diff --git a/root/home.php b/root/home.php
deleted file mode 100644 (file)
index a02e1c0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php get_header(); ?>
-<main class="blog-home">
-<!--    <article <?php // post_class() ?> id="interior-featured">
-        <?php // GLM_get_header(); ?>
-    </article> -->
-    <div class="row">
-        <?php get_template_part('parts/blog-content-area'); ?>
-        <?php get_template_part('parts/blog-sidebar-r'); ?>
-    </div>
-    <?php get_footer(); ?>
-
-
-
index cfeba0c..d2cf1e7 100644 (file)
@@ -1,5 +1,16 @@
 <?php get_header(); ?>
-<main class="page-inside">
+<?php if (is_front_page()) { ?>
+    <?php get_template_part('parts/front-view'); ?>
+<?php } elseif (is_home()) { ?>
+    <?php get_template_part('parts/home'); ?>
+<?php } elseif (is_archive()) { ?>
+    <?php get_template_part('parts/archive'); ?>
+<?php } elseif (is_single()) { ?>
+    <?php get_template_part('parts/single'); ?>
+<?php } elseif (is_search()) { ?>
+    <?php get_template_part('parts/search-results'); ?>
+<?php } else { ?>
+    <main class="page-inside">
         <div id="content-wrapper">
             <div class="row">
                 <?php
@@ -15,4 +26,6 @@
 -->
             </div>
         </div>
+<?php } ?>
+
 <?php get_footer(); ?>
diff --git a/root/parts/archive.php b/root/parts/archive.php
new file mode 100644 (file)
index 0000000..ef2c76b
--- /dev/null
@@ -0,0 +1,5 @@
+<main class="blog-archive">
+    <div class="row">
+        <?php get_template_part('parts/blog-content-area'); ?>
+        <?php get_template_part('parts/blog-sidebar-r'); ?>
+    </div>
diff --git a/root/parts/front-view.php b/root/parts/front-view.php
new file mode 100644 (file)
index 0000000..c732b9f
--- /dev/null
@@ -0,0 +1,19 @@
+<main class="page-front">
+    <div class="row">
+        <?php get_template_part('parts/slide-show');?>
+    </div>
+    <div id="content-wrapper">
+        <div class="row" data-equalizer data-options="equalize_on_stack: false">
+            <?php
+            get_template_part('parts/glm-blocks');
+            ?>
+        </div>
+        <div class="row">
+            <?php get_template_part('parts/main-content');?>
+
+            <div class="small-12 medium-6 large-4 columns small-text-center medium-text-left">
+                <?php get_sidebar(); ?>
+            </div>
+
+        </div>
+    </div>
\ No newline at end of file
index 57633a7..9fde46a 100644 (file)
         
         <br><a name="copyright">copyright</a> 
 <div id="copyright" class="row">
-    <span>&copy; <?php echo date('Y');?> {%= title %}</span>
+    <span>&copy; <?php echo date('Y');?> </span>
     <span class="bullet"> &#8226; </span>
     <span> All Rights Reserved.</span>
     <span class="bullet"> &#8226; </span>
diff --git a/root/parts/home.php b/root/parts/home.php
new file mode 100644 (file)
index 0000000..3dccb05
--- /dev/null
@@ -0,0 +1,11 @@
+<main class="blog-home">
+<!--    <article <?php // post_class() ?> id="interior-featured">
+        <?php // GLM_get_header(); ?>
+    </article> -->
+    <div class="row">
+        <?php get_template_part('parts/blog-content-area'); ?>
+        <?php get_template_part('parts/blog-sidebar-r'); ?>
+    </div>
+
+
+
diff --git a/root/parts/search-result.php b/root/parts/search-result.php
new file mode 100644 (file)
index 0000000..9faa65f
--- /dev/null
@@ -0,0 +1,111 @@
+
+<main class="search-results">
+    <div class="row">
+        <?php if (get_search_query() == "") { ?>
+        <br><h2 class="search-result-header small-12 columns">Please enter a query in the search box. </h2>
+        <?php } else { ?>
+        <br><h2 class="search-result-header small-12 columns">Search Results for "<?php echo get_search_query(); ?>"</h2>
+    </div>
+    
+    <div class="row">
+        <div id="blog-posts-over" class="small-12 columns">
+            <?php if(have_posts()) : while(have_posts()): the_post();?>
+                <?php if (is_search() && (isset($_GET['searchType']) && $_GET['searchType'] == 'blog') && ($post->post_type=='page')) continue; ?>
+            <div class="row content search-result-container">
+                <div class="small-11 small-centered columns">
+                    <article id="<?php the_ID()?>" <?php post_class()?>>
+                        <header class="entry-header">
+                            <h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h1>
+                            <span class="meta date">Posted on <?php the_time('F jS, Y') ?></span>
+                        </header>
+
+
+                <!-- Start of the Contextual/Highlight Search -->
+                                <?php
+                                // Configuration
+                                $max_length = 400; // Max length in characters
+                                $min_padding = 30; // Min length in characters of the context to place around found search terms
+
+                                // Load content as plain text
+                                global $wp_query, $post;
+                                $content = (!post_password_required($post) ? strip_tags(preg_replace(array("/\r?\n/", '@<\s*(p|br\s*/?)\s*>@'), array(' ', "\n"), apply_filters('the_content', $post->post_content))) : '');
+
+                                // Search content for terms
+                                $terms = $wp_query->query_vars['search_terms'];
+                                if ( preg_match_all('/'.str_replace('/', '\/', join('|', $terms)).'/i', $content, $matches, PREG_OFFSET_CAPTURE) ) {
+                                    $padding = max($min_padding, $max_length / (2*count($matches[0])));
+
+                                  // Construct extract containing context for each term
+                                  $output = '';
+                                  $last_offset = 0;
+                                  foreach ( $matches[0] as $match ) {
+                                    list($string, $offset) = $match;
+                                    $start  = $offset-$padding;
+                                    $end = $offset+strlen($string)+$padding;
+                                    // Preserve whole words
+                                    while ( $start > 1 && preg_match('/[A-Za-z0-9\'"-]/', $content{$start-1}) ) $start--;
+                                    while ( $end < strlen($content)-1 && preg_match('/[A-Za-z0-9\'"-]/', $content{$end}) ) $end++;
+                                    $start = max($start, $last_offset);
+                                    $context = substr($content, $start, $end-$start);
+                                    if ( $start > $last_offset ) $context = '...'.$context;
+                                    $output .= $context;
+                                    $last_offset = $end;
+                                  }
+
+                                  if ( $last_offset != strlen($content)-1 ) $output .= '...';
+                                } else {
+                                  $output = $content;
+                                }
+
+                                if ( strlen($output) > $max_length ) {
+                                  $end = $max_length-3;
+                                  while ( $end > 1 && preg_match('/[A-Za-z0-9\'"-]/', $output{$end-1}) ) $end--;
+                                  $output = substr($output, 0, $end) . '...';
+                                }
+
+                                // Highlight matches
+                                $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '<strong>$0</strong>', $output));
+                                ?>
+
+                                <p class="search_result_context">
+                                  <?php echo $context ?>
+                                </p>
+                                <p>
+                                  <a href="<?php the_permalink() ?>" rel="bookmark">Read this entry</a>
+                                </p>
+                <!-- End of the Contextual/Highlight Search -->
+
+                        <?php //echo (function_exists('the_advanced_excerpt')) ? the_advanced_excerpt(): the_excerpt(); ?>
+                        <footer class="entry-meta small-12 medium-6 medium-push-3 center">
+                            <?php
+                            if (has_category()) {
+                                $post_categories = wp_get_post_categories( get_the_ID() );
+                                $cats = array();
+                                echo 'This entry was posted ';
+                                echo '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>';
+                                }
+                                echo '.';
+                            }
+                            ?>
+                        </footer>
+                    </article>
+                </div>
+            </div>
+            <?php endwhile; ?>
+            <div class="navigation">
+                <span class="newer"><?php previous_posts_link(__('« Newer','example')) ?></span> <span class="older"><?php next_posts_link(__('Older »','example')) ?></span>
+            </div><!-- /.navigation -->
+            <?php else: ?>
+            <div id="post-404" class="noposts">
+                <p><?php _e('Sorry, no results were found.');?></p>
+            </div><!-- /#post-404 -->
+            <?php endif;?>
+        </div>
+            
+            <?php } ?> <!-- end empty query check -->
+        </div>
+    
diff --git a/root/parts/single.php b/root/parts/single.php
new file mode 100644 (file)
index 0000000..cd85b7d
--- /dev/null
@@ -0,0 +1,36 @@
+<main class="blog-single">
+    <div class="row">
+        <div id="blog-posts-over" class="small-12 medium-9 columns">
+            <?php if(have_posts()) : while(have_posts()): the_post();?>
+            <div class="row blog-post-container">
+                <div class="small-11 small-centered columns">
+                    <div class="row">
+                        <div class="small-12 columns">
+                            <article id="<?php the_ID()?>" <?php post_class()?>>
+                                <header class="entry-header">
+                                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
+                                    <?php if ( has_post_thumbnail() ):?>
+                                             <?php if (get_post_type( $post ) != "ai1ec_event") { ?>
+                                    <div class="featured-image-wrap"><?php the_post_thumbnail("large"); ?></div>
+                                    <?php } ?>
+                                    <?php endif; ?>
+                                    <span class="meta date">Posted on <?php the_time('F jS, Y') ?></span>
+                                </header>
+                                <?php echo the_content(); ?>
+                            </article>
+                            <?php if ( comments_open() || get_comments_number() ) :
+                            comments_template();
+                            endif; ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <?php endwhile; ?>
+            <?php else: ?>
+            <div id="post-404" class="noposts">
+                <p><?php _e('Sorry, no results were found.');?></p>
+            </div><!-- /#post-404 -->
+            <?php endif;?>
+        </div>
+        <?php get_template_part('parts/blog-sidebar-r'); ?>
+    </div>
index d34aeb2..34350ba 100644 (file)
@@ -1,4 +1,4 @@
-<nav class="top-bar show-for-large-up" data-topbar role="navigation">
+<nav class="top-bar text-center show-for-large-up" data-topbar role="navigation">
     <section class="top-bar-section">
         <?php glm_theme_top_bar(); ?>
     </section>
diff --git a/root/search.php b/root/search.php
deleted file mode 100644 (file)
index b7e5d7e..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php get_header(); ?>
-<main class="search-results">
-    <div class="row">
-        <?php if (get_search_query() == "") { ?>
-        <br><h2 class="search-result-header small-12 columns">Please enter a query in the search box. </h2>
-        <?php } else { ?>
-        <br><h2 class="search-result-header small-12 columns">Search Results for "<?php echo get_search_query(); ?>"</h2>
-    </div>
-    
-    <div class="row">
-        <div id="blog-posts-over" class="small-12 columns">
-            <?php if(have_posts()) : while(have_posts()): the_post();?>
-                <?php if (is_search() && (isset($_GET['searchType']) && $_GET['searchType'] == 'blog') && ($post->post_type=='page')) continue; ?>
-            <div class="row content search-result-container">
-                <div class="small-11 small-centered columns">
-                    <article id="<?php the_ID()?>" <?php post_class()?>>
-                        <header class="entry-header">
-                            <h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h1>
-                            <span class="meta date">Posted on <?php the_time('F jS, Y') ?></span>
-                        </header>
-
-
-                <!-- Start of the Contextual/Highlight Search -->
-                                <?php
-                                // Configuration
-                                $max_length = 400; // Max length in characters
-                                $min_padding = 30; // Min length in characters of the context to place around found search terms
-
-                                // Load content as plain text
-                                global $wp_query, $post;
-                                $content = (!post_password_required($post) ? strip_tags(preg_replace(array("/\r?\n/", '@<\s*(p|br\s*/?)\s*>@'), array(' ', "\n"), apply_filters('the_content', $post->post_content))) : '');
-
-                                // Search content for terms
-                                $terms = $wp_query->query_vars['search_terms'];
-                                if ( preg_match_all('/'.str_replace('/', '\/', join('|', $terms)).'/i', $content, $matches, PREG_OFFSET_CAPTURE) ) {
-                                    $padding = max($min_padding, $max_length / (2*count($matches[0])));
-
-                                  // Construct extract containing context for each term
-                                  $output = '';
-                                  $last_offset = 0;
-                                  foreach ( $matches[0] as $match ) {
-                                    list($string, $offset) = $match;
-                                    $start  = $offset-$padding;
-                                    $end = $offset+strlen($string)+$padding;
-                                    // Preserve whole words
-                                    while ( $start > 1 && preg_match('/[A-Za-z0-9\'"-]/', $content{$start-1}) ) $start--;
-                                    while ( $end < strlen($content)-1 && preg_match('/[A-Za-z0-9\'"-]/', $content{$end}) ) $end++;
-                                    $start = max($start, $last_offset);
-                                    $context = substr($content, $start, $end-$start);
-                                    if ( $start > $last_offset ) $context = '...'.$context;
-                                    $output .= $context;
-                                    $last_offset = $end;
-                                  }
-
-                                  if ( $last_offset != strlen($content)-1 ) $output .= '...';
-                                } else {
-                                  $output = $content;
-                                }
-
-                                if ( strlen($output) > $max_length ) {
-                                  $end = $max_length-3;
-                                  while ( $end > 1 && preg_match('/[A-Za-z0-9\'"-]/', $output{$end-1}) ) $end--;
-                                  $output = substr($output, 0, $end) . '...';
-                                }
-
-                                // Highlight matches
-                                $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '<strong>$0</strong>', $output));
-                                ?>
-
-                                <p class="search_result_context">
-                                  <?php echo $context ?>
-                                </p>
-                                <p>
-                                  <a href="<?php the_permalink() ?>" rel="bookmark">Read this entry</a>
-                                </p>
-                <!-- End of the Contextual/Highlight Search -->
-
-                        <?php //echo (function_exists('the_advanced_excerpt')) ? the_advanced_excerpt(): the_excerpt(); ?>
-                        <footer class="entry-meta small-12 medium-6 medium-push-3 center">
-                            <?php
-                            if (has_category()) {
-                                $post_categories = wp_get_post_categories( get_the_ID() );
-                                $cats = array();
-                                echo 'This entry was posted ';
-                                echo '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>';
-                                }
-                                echo '.';
-                            }
-                            ?>
-                        </footer>
-                    </article>
-                </div>
-            </div>
-            <?php endwhile; ?>
-            <div class="navigation">
-                <span class="newer"><?php previous_posts_link(__('« Newer','example')) ?></span> <span class="older"><?php next_posts_link(__('Older »','example')) ?></span>
-            </div><!-- /.navigation -->
-            <?php else: ?>
-            <div id="post-404" class="noposts">
-                <p><?php _e('Sorry, no results were found.');?></p>
-            </div><!-- /#post-404 -->
-            <?php endif;?>
-        </div>
-            
-            <?php } ?> <!-- end empty query check -->
-        </div>
-    
-    <?php get_footer(); ?>
diff --git a/root/single.php b/root/single.php
deleted file mode 100644 (file)
index bef202d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php get_header(); ?>
-<main class="blog-single">
-    <div class="row">
-        <div id="blog-posts-over" class="small-12 medium-9 columns">
-            <?php if(have_posts()) : while(have_posts()): the_post();?>
-            <div class="row blog-post-container">
-                <div class="small-11 small-centered columns">
-                    <div class="row">
-                        <div class="small-12 columns">
-                            <article id="<?php the_ID()?>" <?php post_class()?>>
-                                <header class="entry-header">
-                                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
-                                    <?php if ( has_post_thumbnail() ):?>
-                                             <?php if (get_post_type( $post ) != "ai1ec_event") { ?>
-                                    <div class="featured-image-wrap"><?php the_post_thumbnail("large"); ?></div>
-                                    <?php } ?>
-                                    <?php endif; ?>
-                                    <span class="meta date">Posted on <?php the_time('F jS, Y') ?></span>
-                                </header>
-                                <?php echo the_content(); ?>
-                            </article>
-                            <?php if ( comments_open() || get_comments_number() ) :
-                            comments_template();
-                            endif; ?>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <?php endwhile; ?>
-            <?php else: ?>
-            <div id="post-404" class="noposts">
-                <p><?php _e('Sorry, no results were found.');?></p>
-            </div><!-- /#post-404 -->
-            <?php endif;?>
-        </div>
-        <?php get_template_part('parts/blog-sidebar-r'); ?>
-    </div>
-    <?php get_footer(); ?>