last min edits
authorIan Weller <ian@gaslightmedia.com>
Wed, 11 Feb 2015 14:27:24 +0000 (09:27 -0500)
committerIan Weller <ian@gaslightmedia.com>
Wed, 11 Feb 2015 14:27:24 +0000 (09:27 -0500)
functions.php
header.php

index 6fdb898..2842ccf 100644 (file)
@@ -1,4 +1,45 @@
 <?php
+
+
+$ancestorId   = null;
+$includePages = array();
+$frontPageId  = get_option('page_on_front');
+add_action('widgets_init', 'glm_quicksite_widget_init');
+
+if (!function_exists('glm_quicksite_widget_init')) {
+
+    function glm_quicksite_widget_init()
+    {
+        register_sidebar(array(
+            'name'        => __('Left Sidebar'),
+            'id'          => 'sidebar-l',
+            'description' => __('Appears in Left Sidebar')
+        ));
+        register_sidebar(array(
+            'name'        => __('Footer'),
+            'id'          => 'sidebar-f',
+            'description' => __('Appears in Footer Area')
+        ));
+    }
+
+}
+
+/**
+ * get_menu_options
+ *
+ * Grab the menu options from the theme.ini file
+ */
+function glm_get_menu_options()
+{
+    static $menu_options;
+    $themeConfig = get_template_directory() . '/theme.ini';
+
+    if (!$menu_options && is_file($themeConfig)) {
+        $menu_options = parse_ini_file($themeConfig, true);
+    }
+    return $menu_options;
+}
+
 /**
  * glm_page_menu
  *
@@ -6,9 +47,10 @@
  */
 function glm_page_menu($parent = 0, $class = '')
 {
+    $menuConfig   = glm_get_menu_options();
     $frontPageId  = get_option('page_on_front');
-    $parents = array();
-    $pages = get_pages(array(
+    $parents      = array();
+    $args         = array(
         'post_type'   => 'page',
         'parent'      => $parent,
         'number'      => '',
@@ -16,7 +58,11 @@ function glm_page_menu($parent = 0, $class = '')
         'post_status' => 'publish',
         'sort_order'  => 'asc',
         'sort_column' => 'menu_order'
-    ));
+    );
+    if ($parent == 0 && $menuConfig['menu_options']['main_level_pages']) {
+        $args['include'] = $menuConfig['menu_options']['main_level_pages'];
+    }
+    $pages = get_pages($args);
     echo '<ul'.(($class)?' class="'.$class.'"':'').'><!-- begin -->'."\n";
     foreach ($pages as $page) {
         $childs = get_pages('child_of=' . $page->ID);
@@ -33,6 +79,17 @@ function glm_page_menu($parent = 0, $class = '')
 }
 
 
+function SearchFilter($query) {
+    if(isset($_GET['searchType'])) {
+        $searchType = $_GET['searchType'];
+        if ($searchType == 'blog' && !is_admin()) {
+            $query->set('post_type', 'post');
+        }
+    }
+    return $query;
+}
+add_filter('pre_get_posts','SearchFilter');
+
 /**
  * glm_offcanvas_menu
  *
@@ -47,44 +104,64 @@ function glm_offcanvas_menu()
     ));
 }
 
+add_theme_support('post-thumbnails');
+set_post_thumbnail_size(120, 100, true);
+/**
+ * glm_site_scripts
+ *
+ * Add the scripts that we'll need for any home page stuff
+ */
 function glm_site_scripts()
 {
     wp_enqueue_script(
         'modernizr',
-        get_template_directory_uri() . '/js/vendor/modernizr.js'
+        get_template_directory_uri() . '/js/modernizr/modernizr.min.js'
     );
+    wp_enqueue_script('jquery');
     wp_enqueue_script(
+        'glm_foundation',
+        get_template_directory_uri() . '/js/app.js',
         'jquery',
-        get_template_directory_uri() . '/js/vendor/jquery.js'
-    );
-    wp_enqueue_script(
-        'dollarsign',
-        get_template_directory_uri() . '/js/dollarsign.js'
-    );
-    wp_enqueue_script(
-        'foundation',
-        get_template_directory_uri() . '/js/foundation.min.js',
-        'jquery',
-        '1.0',
-        true
-    );
-    wp_enqueue_script(
-        'pageSetup',
-        get_template_directory_uri() . '/js/pageSetup.js',
-        'foundation',
         '1.0',
         true
     );
     if(is_front_page()) {
-        wp_enqueue_script(
-            'cycle_script',
-            get_template_directory_uri() . '/js/jquery.cycle2.min.js',
-            'jquery',
-            '1.0',
-            true
-        );
     }
 
 }
+
+
+/* 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;';
+    } else {
+            echo ' style="background-image: url('.get_template_directory_uri().'/assets/default-header.gif);height:0;padding:0;padding-bottom:30%;background-position:center center;background-size: 100%;background-repeat:no-repeat;';
+    }
+    echo 'max-height: 300px; ">';
+    echo '</div>';
+    echo '<div class="row">';
+    echo '<div class="small-12 columns">';
+    echo '</div>';
+    echo '</div>';
+}
+
+// // The code below is useful when you want the image to resize to
+//    if (has_post_thumbnail()) {
+//            $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
+//            echo '<img src="'.$image_data[0].'" style="no-repeat;max-height:400px;">';
+//    } else {
+//            echo '<img src="'.get_template_directory_uri().'/assets/default-header.gif" style="max-height:400px;">';
+//    }
+//    echo '<div class="row">';
+//    echo '<div class="small-12 columns">';
+//    echo '</div>';
+//    echo '</div>';
+
+
+
 add_action('wp_enqueue_scripts', 'glm_site_scripts');
 ?>
index 5f4a9b4..abe0a94 100644 (file)
@@ -3,7 +3,7 @@
   <head>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>Gilmore Car Museum</title>
+    <title><?php wp_title(); ?></title>
     <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/app.css"/>
     <?php wp_head();?>
     <link href='http://fonts.googleapis.com/css?family=Balthazar' rel='stylesheet' type='text/css'>