From 2c0c67e4cc96ee095cb48136e6b1112e4ddf49e9 Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Mon, 9 Jan 2017 09:17:53 -0500 Subject: [PATCH] modifying the theme I am trying to make the theme more generic. I removed somethings and added others. --- functions.php | 151 +------------------------------------- header.php | 30 ++++---- lib/navigation.php | 35 +++++---- page.php | 11 +-- parts/off-canvas-menu.php | 14 ---- parts/top-bar.php | 2 +- 6 files changed, 42 insertions(+), 201 deletions(-) diff --git a/functions.php b/functions.php index 2d12e7f..e1a7394 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,6 @@ 'Site Navigation', - //'mobile-off-canvas' => 'Mobile', -// 'footer' => 'Footer' -)); - -if ( ! function_exists( 'michsci_top_bar' ) ) { - function michsci_top_bar() { - wp_nav_menu(array( - 'container' => false, // remove nav container - 'container_class' => '', // class of container - - 'items_wrap' => '', - - 'menu' => '', // menu name - 'menu_class' => '', // adding custom nav class - 'theme_location' => 'top-bar', // where it's located in the theme - 'before' => '', // before each link - 'after' => '', // after each link - 'link_before' => '', // before each link text - 'link_after' => '', // after each link text - // limit the depth of the nav - 'fallback_cb' => false, // fallback function (see below) - 'walker' => new MichiganSci_Top_Bar_Walker() - )); - } -} -if ( ! class_exists( 'MichiganSci_Top_Bar_Walker()' ) ) : -class MichiganSci_Top_Bar_Walker extends Walker_Nav_Menu { - - function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { - $element->has_children = ! empty( $children_elements[ $element->ID ] ); - $element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : ''; - $element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'has-dropdown' : ''; - $element->classes[] = ( $element->post_parent == 0 && $element->menu_order > 10 ) ? 'drop-right' : 'drop-left'; - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); - } - function start_lvl( &$output, $depth = 0, $args = array() ) { - $output .= "\n'."\n"; -} - /** * Return the client info option for the given key * @@ -165,20 +49,7 @@ if (!function_exists('glm_get_clientinfo_option')) { } } -/** - * glm_offcanvas_menu - * - * Generate the list of pages as nested ul li list - */ -function glm_offcanvas_menu() -{ - wp_page_menu(array( - 'depth' => 0, - 'sort_column' => 'menu_order', - 'menu_class' => 'left-off-canvas-list' - )); -} - +add_theme_support('custom-fieldss'); add_theme_support('post-thumbnails'); set_post_thumbnail_size(120, 100, true); add_image_size('glm-block-thumb', 280, 186, true); @@ -239,21 +110,7 @@ function glm_get_header() { // echo ''; -function glm_side_menu() { - global $post; - $parents = get_post_ancestors($post->ID); - $id = ($parents) ? $parents[count($parents)-1]: $post->ID; - $parent = get_page( $id ); - if ($id == 0) { - $ID = $post->ID; - } else { - $ID = $parent->ID; - } - echo '

'.get_the_title($ID).'

'; - echo ''."\n"; -} + add_action('wp_enqueue_scripts', 'glm_site_scripts'); diff --git a/header.php b/header.php index 249bfa9..7afcfe4 100644 --- a/header.php +++ b/header.php @@ -9,25 +9,25 @@ - + >
-
- -
-
-
-
- +
+ + + +

+ +

+ +

+
diff --git a/lib/navigation.php b/lib/navigation.php index c172e80..d18b3f9 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -2,6 +2,7 @@ register_nav_menus(array( 'top-bar' => 'Site Navigation' + )); /** @@ -71,6 +72,25 @@ if ( ! function_exists( 'glm_theme_footer' ) ) { } } +/** + * Sidebar Nav + */ +function glm_side_menu() { + global $post; + $parents = get_post_ancestors($post->ID); + $id = ($parents) ? $parents[count($parents)-1]: $post->ID; + $parent = get_page( $id ); + if ($id == 0) { + $ID = $post->ID; + } else { + $ID = $parent->ID; + } + echo '

'.get_the_title($ID).'

'; + echo ''."\n"; +} + /** * glm_page_menu * @@ -139,19 +159,4 @@ function glm_get_menu_options() return $menu_options; } -function glm_side_menu() { - global $post; - $parents = get_post_ancestors($post->ID); - $id = ($parents) ? $parents[count($parents)-1]: $post->ID; - $parent = get_page( $id ); - if ($id == 0) { - $ID = $post->ID; - } else { - $ID = $parent->ID; - } - echo '

'.get_the_title($ID).'

'; - echo ''."\n"; -} diff --git a/page.php b/page.php index db77f80..88232bc 100644 --- a/page.php +++ b/page.php @@ -1,11 +1,5 @@
-
'; - - get_template_part('parts/glm-kitchen-sink'); - echo '
'; - } else { ?>
- +
-
+
@@ -30,5 +24,4 @@
- diff --git a/parts/off-canvas-menu.php b/parts/off-canvas-menu.php index 2614219..c9f9451 100644 --- a/parts/off-canvas-menu.php +++ b/parts/off-canvas-menu.php @@ -1,18 +1,4 @@ diff --git a/parts/top-bar.php b/parts/top-bar.php index 21dff7b..c5ee3b1 100644 --- a/parts/top-bar.php +++ b/parts/top-bar.php @@ -1,6 +1,6 @@ -- 2.17.1