From 206b094533dcb9a72454c5495792cbf2c2fe4682 Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Wed, 11 Feb 2015 09:27:24 -0500 Subject: [PATCH] last min edits --- functions.php | 133 +++++++++++++++++++++++++++++++++++++++----------- header.php | 2 +- 2 files changed, 106 insertions(+), 29 deletions(-) diff --git a/functions.php b/functions.php index 6fdb898..2842ccf 100644 --- a/functions.php +++ b/functions.php @@ -1,4 +1,45 @@ __('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 ''."\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 ''; + echo ''; + echo '
'; + echo '
'; + echo '
'; + echo '
'; +} + +// // 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 ''; +// } else { +// echo ''; +// } +// echo '
'; +// echo '
'; +// echo '
'; +// echo '
'; + + + add_action('wp_enqueue_scripts', 'glm_site_scripts'); ?> diff --git a/header.php b/header.php index 5f4a9b4..abe0a94 100644 --- a/header.php +++ b/header.php @@ -3,7 +3,7 @@ - Gilmore Car Museum + <?php wp_title(); ?> -- 2.17.1