working on the blog
authorIan Weller <ian@gaslightmedia.com>
Fri, 19 Jan 2018 21:55:16 +0000 (16:55 -0500)
committerIan Weller <ian@gaslightmedia.com>
Fri, 19 Jan 2018 21:55:16 +0000 (16:55 -0500)
I am trying to get the blog set up.  It needs a lot more work.

archive.php
home.php
search.php
single.php

index de96ac4..020b36b 100644 (file)
@@ -1,4 +1,11 @@
 <?php get_header(); ?>
+<div id="panel">
+    <div class="row">
+        <div class="small-11 small-centered columns">
+            <h1 id="pan-text">Helping You Build With Confidence Since 1915</h1>
+        </div>
+    </div>
+</div>
 <main class="blog-archive">
     <div class="row">
         <div id="blog-posts-over" class="small-12 medium-9 columns">
@@ -39,7 +46,9 @@
                 <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_template_part('parts/blog-sidebar-r'); ?>
     </div>
+</main>
     <?php get_footer(); ?>
index 04d56bb..a8ffb9c 100644 (file)
--- a/home.php
+++ b/home.php
@@ -1,91 +1,55 @@
 <?php get_header(); ?>
 <div id="panel">
-    <div class="row">
-        <div class="small-12 columns">
-            <img id="still" src="<?php echo get_template_directory_uri(); ?>/assets/header_img.jpg">
-        </div>
-    </div>
     <div class="row">
         <div class="small-11 small-centered columns">
             <h1 id="pan-text">Helping You Build With Confidence Since 1915</h1>
         </div>
     </div>
 </div>
-<div class="row">
-    <div id="searchform_container" class="small-12 medium-3 columns alignright">
-        <form id="searchform" action="<?php bloginfo('url'); ?>" method="get">
-            <div><input id="s" class="text" type="text" name="s" value="" />
-            <input class="submit button blogbutton" type="submit" name="submit" value="Search" />
-            <input type="hidden" name="searchType" value="blog" /> </div>
-        </form>
-    </div>
-    <div id="blog-posts-over" class="small-12 medium-9 columns">
-        
-        <?php if(have_posts()): $i = 1; while (have_posts() && $i < 6) : the_post(); ?>
-        <div class="row content" id="blog-posts-container">
-            <div class="small-11 small-centered columns">
-                <div class="row">
-                    <div class="small-12 columns">
-                        <ul class="breadcrumbs">
+<main class="blog-home">
+    <div class="row">
+        <div id="blog-posts-over" class="small-12 medium-9 columns">
+            <?php if(have_posts()): $i = 1; while (have_posts() && $i < 6) : the_post(); ?>
+            <div class="row content" id="blog-posts-container">
+                <div class="small-11 small-centered columns">
+                    <div class="row">
+                        <div class="small-12 columns">
+                            <ul class="breadcrumbs">
 
-                        </ul>
+                            </ul>
+                        </div>
                     </div>
-                </div>
-                <div class="row">
-                    <div class="small-12 columns">
+                    <div class="row">
+                        <div class="small-12 columns">
 
-                        <article id="<?php the_ID()?>" <?php post_class()?>>
-                            <header class="entry-header">
+                            <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>
-                                <span class="meta"> Posted on <strong><?php the_time('F jS, Y'); ?></strong> </span>
+                                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
+                                    <span class="meta"> Posted on <strong><?php the_time('F jS, Y'); ?></strong> </span>
 
 
-                            </header>
+                                </header>
 
-                            <?php echo the_advanced_excerpt('length=200&length_type=words&no_custom=1&ellipsis=%26hellip;'); ?>
-                            <hr>
-                        </article>
+                                <?php echo the_advanced_excerpt('length=200&length_type=words&no_custom=1&ellipsis=%26hellip;'); ?>
+                                <hr>
+                            </article>
+                        </div>
                     </div>
                 </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 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>
-    <div class="row content small-12 medium-3">
-    <div id="blog-side-info" class="alignright small-12 medium-3">
-        
-        <p>Recent Posts</p>
-        <ul>
-        <?php
-                $args = array( 'numberposts' => '5' );
-                $recent_posts = wp_get_recent_posts( $args );
-                foreach( $recent_posts as $recent ){
-                        echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   $recent["post_title"].'</a> </li> ';
-                }
-        ?>
-        </ul>
-        <p>Archive</p>
-        <ul><?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12 ) ); ?></ul>
-        <p>Categories</p>
-        <ul>
-            <?php
-            $args = array(
-            'orderby' => 'name',
-            'order' => 'ASC'
-            );
-          $categories = get_categories($args);
-            foreach($categories as $category) { 
-              echo '<li><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';  } 
-            ?>
-        </ul>
+        <?php get_template_part('parts/blog-sidebar-r'); ?>
     </div>
+</main>
+
         <?php get_footer(); ?>
index f8de830..719fd61 100644 (file)
 <?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) . '...';
-                                }
+<div>
+    <h2 class="search-result-header">Search Results for "<?php echo get_search_query(); ?>"</h2>
+    <div id="blog-posts-over" class="small-12 columns">
+
+        <?php if(have_posts()): $i = 1; while (have_posts() && $i < 6) : the_post(); ?>
+        <div class="content" id="blog-posts-container">
+            <div class="small-12 small-centered columns">
+                <div class="row">
+                    <div class="small-12 columns">
+                        <?php
+                        if(function_exists('bcn_display') && !is_front_page()) {
+                            echo "<div class=\"breadcrumbs\">";
+                            bcn_display();
+                            echo "</div>";
+                        }
+                        ?>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="small-12 columns">
+
+                        <article id="<?php the_ID()?>" <?php post_class()?>>
+                                <h2 class="">Page: <a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
+                                <hr>
+                            <?php the_post_thumbnail(); ?>
+                            <?php echo the_advanced_excerpt('length=200&length_type=words&no_custom=1&ellipsis=%26hellip;'); ?>
+                            <footer class="entry-meta small-12 medium-6 medium-push-3 center">
+                                
+                                <?php $post_categories = wp_get_post_categories( get_the_ID() );
+                                $cats = array();
 
-                                // 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>
+                            </footer>
+                            <hr>
+                        </article>
+                    </div>
                 </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(); ?>
\ No newline at end of file
+        <?php endwhile; ?>
+        <?php if ( function_exists('FoundationPress_pagination') ) { FoundationPress_pagination(); } else if ( is_paged() ) { ?>
+
+               <nav id="post-nav">
+                       <div class="post-previous"><?php next_posts_link( __( '&larr; Older results', 'FoundationPress' ) ); ?></div>
+                       <div class="post-next"><?php previous_posts_link( __( 'Newer results &rarr;', 'FoundationPress' ) ); ?></div>
+               </nav>
+       <?php } ?>
+        <?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_footer(); ?>
index 544a472..2b2d99e 100644 (file)
             </div><!-- /#post-404 -->
             <?php endif;?>
         </div>
-        <?php get_template_part('parts/blog-sidebar-r'); ?>
+        <div class="row content small-12 medium-3">
+            <div id="blog-side-info" class="alignright small-12 medium-3">
+
+                <p>Recent Posts</p>
+                <ul>
+                <?php
+                        $args = array( 'numberposts' => '5' );
+                        $recent_posts = wp_get_recent_posts( $args );
+                        foreach( $recent_posts as $recent ){
+                                echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   $recent["post_title"].'</a> </li> ';
+                        }
+                ?>
+                </ul>
+                <p>Archive</p>
+                <ul><?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12 ) ); ?></ul>
+                <p>Categories</p>
+                <ul>
+                    <?php
+                    $args = array(
+                    'orderby' => 'name',
+                    'order' => 'ASC'
+                    );
+                  $categories = get_categories($args);
+                    foreach($categories as $category) { 
+                      echo '<li><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';  } 
+                    ?>
+                </ul>
+            </div>
+        </div>
     </div>
 </main>
                 <footer class="small-10 small-centered columns">