Featured image GLM style, order subsections,etc
authorLaury GvR <laury@gaslightmedia.com>
Mon, 7 Aug 2017 13:25:22 +0000 (09:25 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Mon, 7 Aug 2017 13:25:22 +0000 (09:25 -0400)
- Featured image : now retrieved from Featured image set for
    home page in admin.
- Featured image : gut the current implementation and use what we
    always do on our other themes (glm_get_header) with some edits.
- Subections are now ordered by menu order
- Clicking the active tab no longer hides its content.

assets/images/cropped-header.jpg [new file with mode: 0644]
assets/js/global.js
assets/js/navigation.js
front-page.php
functions.php
header.php
index.php
style.css
template-parts/page/content-front-page.php

diff --git a/assets/images/cropped-header.jpg b/assets/images/cropped-header.jpg
new file mode 100644 (file)
index 0000000..ead14fa
Binary files /dev/null and b/assets/images/cropped-header.jpg differ
index dec6e62..a7b54d1 100755 (executable)
                 }
                 target = $(this).attr('id').split("-")[1];
                 parent_target = $(this).parents('.parent-container').attr('id').split("-")[1];
-                $('#nav-'+parent_target+' .page-nav-container li').removeClass("active");
-                $(this).parents('.page-nav-container li').toggleClass("active");
+                if ( !$(this).parents('.page-nav-container li').hasClass("active") ) {
+                    $('#nav-'+parent_target+' .page-nav-container li').removeClass("active");
+                    $(this).parents('.page-nav-container li').toggleClass("active");
+                    //alert("test");
+    //                alert(parent_target);
+                    $('#content-'+parent_target+' .page-content-container article:not(#page-'+target+')').addClass('inactive').removeClass('active');
+                    $('#content-'+parent_target+' .page-content-container #page-'+target).toggleClass('inactive').toggleClass('active');
 
-                //alert("test");
-//                alert(parent_target);
-                $('#content-'+parent_target+' .page-content-container article:not(#page-'+target+')').addClass('inactive').removeClass('active');
-                $('#content-'+parent_target+' .page-content-container #page-'+target).toggleClass('inactive').toggleClass('active');
+                }
             });
                // If navigation menu is present on page, setNavProps and adjustScrollClass.
 //             if ( $navigation.length ) {
index 101cefa..c85f414 100755 (executable)
         function setActiveNavItem() {
             console.log("here");
             $(".nav-parent").each(function() {
-                if(myTopPosition > $(this).offset().top && ( $(this).offset().top + $(this).next().outerHeight() > myTopPosition-90) ) {
-
-                    $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').addClass("active");
-                } else {
-                    //console.log("no");
-                    $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').removeClass("active");
+                if  ( $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').not(".active") ) {
+                    if(myTopPosition > $(this).offset().top && ( $(this).offset().top + $(this).next().outerHeight() > myTopPosition-90) ) {
+
+                        $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').addClass("active");
+                    } else {
+                        //console.log("no");
+                        $('.top-nav-right-list a[href="#' + $(this).attr("id")  +'"]').removeClass("active");
+                    }
                 }
             });
         }
index a3b3d3a..30bf473 100755 (executable)
@@ -38,7 +38,7 @@ get_header(); ?>
                                 $parent_args = array(
                                         'posts_per_page'   => 0,
                                         'offset'           => 0,
-                                        'orderby'          => 'order',
+                                        'orderby'          => 'menu_order',
                                         'order'            => 'ASC',
                                         'post_type'        => 'page',
                                         'post_parent'      => '0',
@@ -61,7 +61,7 @@ get_header(); ?>
                                             $child_args = array(
                                                 'posts_per_page'   => 0,
                                                 'offset'           => 0,
-                                                'orderby'          => 'order',
+                                                'orderby'          => 'menu_order',
                                                 'order'            => 'ASC',
                                                 'post_type'        => 'page',
                                                 'post_parent'      => $a_parent->ID,
index af3001c..59ad81a 100755 (executable)
@@ -284,6 +284,20 @@ function twentyseventeen_fonts_url() {
        return esc_url_raw( $fonts_url );
 }
 
+/**
+ * Function for getting the header.
+ */
+function glm_get_header() {
+    if (has_post_thumbnail()) {
+            $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
+
+            echo ' <img src="' . $image_data[0] .'">';
+
+    } else {
+            echo ' <img src="' . get_template_directory_uri() . '/assets/images/cropped-header.jpg">';
+    }
+}
+
 /**
  * Add preconnect for Google Fonts.
  *
index 8e9a68f..c9323ae 100755 (executable)
     </div>
     <div id="page" class="site">
 
-       <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentyseventeen' ); ?></a>
-
+        <div class="feature-img">
+            <?php echo glm_get_header(); ?>
+        </div>
        <header id="masthead" class="site-header" role="banner">
 
-               <?php get_template_part( 'template-parts/header/header', 'image' ); ?>
+               <?php // get_template_part( 'template-parts/header/header', 'image' ); ?>
 
                <?php // if ( has_nav_menu( 'top' ) ) : ?>
 <!--
                <?php // endif; ?>
 
        </header><!-- #masthead -->
-
-       <?php
-       // If a regular post or page, and not the front page, show the featured image.
-       if ( has_post_thumbnail() && ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) ) :
-               echo '<div class="single-featured-image-header">';
-               the_post_thumbnail( 'twentyseventeen-featured-image' );
-               echo '</div><!-- .single-featured-image-header -->';
-       endif;
-       ?>
-
        <div class="site-content-contain">
                <div id="content" class="site-content">
index d21a560..ce98d15 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -34,8 +34,6 @@ get_header(); ?>
                        <?php
                        if ( have_posts() ) :
 
-
-
                                 $locations = get_nav_menu_locations();
                                 $menuSlug = "top";
                                 $menu = wp_get_nav_menu_object( $locations[ $menuSlug ] );
index a96b220..7b12272 100755 (executable)
--- a/style.css
+++ b/style.css
@@ -1684,7 +1684,6 @@ a:hover .nav-title,
 }
 @media screen and (max-width: 1280px) {
 
-
        .home .site-navigation-fixed.navigation-top {
                bottom: auto;
                position: relative;
@@ -4764,4 +4763,17 @@ object {
 .nf-form-cont {
   margin: 0 auto;
   max-width: 600px;
+}
+.feature-img {
+    max-height: 500px;
+    overflow: hidden;
+}
+.feature-img img {
+    margin-top: 79px;
+    width: 100%;
+}
+@media (max-width: 1280px) {
+    .feature-img img {
+        margin-top: 128px;
+    }
 }
\ No newline at end of file
index 8a4e1c1..f5e9c75 100755 (executable)
 ?>
 <article id="post-<?php the_ID(); ?>" <?php post_class( 'twentyseventeen-panel ' ); ?> >
 
-       <?php if ( has_post_thumbnail() ) :
-               $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' );
-
-               $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
-
-               $thumbnail_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' );
-
-               // Calculate aspect ratio: h / w * 100%.
-               $ratio = $thumbnail_attributes[2] / $thumbnail_attributes[1] * 100;
-               ?>
-
-               <div class="panel-image" style="background-image: url(<?php echo esc_url( $thumbnail[0] ); ?>);">
-                       <div class="panel-image-prop" style="padding-top: <?php echo esc_attr( $ratio ); ?>%"></div>
-               </div><!-- .panel-image -->
-
-       <?php endif; ?>
-
        <div id="frontpage-content" class="panel-content">
 
                <div class="wrap">