Sidebar styles and markup completed
authorLaury GvR <laury@gaslightmedia.com>
Fri, 9 Sep 2016 21:08:50 +0000 (17:08 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 9 Sep 2016 21:08:50 +0000 (17:08 -0400)
Shop was using shop-sidebar partial, now uses sidebar.php. Can no
longer use the same markup as frontpage since that's significantly
changed now.

parts/cats-and-products.php [new file with mode: 0644]
parts/shop-sidebar.php
scss/_sidebar.scss
scss/plugins/_woocommerce.scss
sidebar.php
woocommerce.php

diff --git a/parts/cats-and-products.php b/parts/cats-and-products.php
new file mode 100644 (file)
index 0000000..eb7bebe
--- /dev/null
@@ -0,0 +1,57 @@
+<h2>Event Dates:</h2>
+
+<?php $args = array(
+         'number'     => $number,
+         'orderby'    => 'title',
+         'order'      => 'ASC',
+         'hide_empty' => $hide_empty,
+         'include'    => $ids
+    );
+    $product_categories = get_terms( 'product_cat', $args );
+    $count = count($product_categories);
+    if ( $count > 0 ){
+        foreach ( $product_categories as $product_category ) {
+            $args = array(
+                'posts_per_page' => -1,
+                'tax_query' => array(
+                    'relation' => 'AND',
+                    array(
+                        'taxonomy' => 'product_cat',
+                        'field' => 'slug',
+                        // 'terms' => 'white-wines'
+                        'terms' => $product_category->slug
+                    )
+                ),
+                'post_type' => 'product',
+                'orderby' => 'title,'
+            );
+            $products = new WP_Query( $args );
+            if ($products->have_posts()) { ?>
+                <div class="side-product-wrapper">
+                    <div class="side-product-container" data-equalizer-watch>
+                        <div class="side-product-content-container">
+                            <?php 
+                            echo '<h5><a href="' . get_term_link( $product_category ) . '">' . $product_category->name . '</a></h5>';
+                            echo "<ul>";
+
+                            while ( $products->have_posts() ) {
+
+                                $products->the_post();
+                                ?>
+                                    <li>
+                                        <a href="<?php the_permalink(); ?>">
+                                            <?php the_title(); ?>
+                                        </a>
+                                    </li>
+                                <?php
+                            }
+                            if ($no_products) {
+                                echo "TBD";
+                            }
+                            echo "</ul>";?>
+                        </div>
+                    </div>
+                </div>
+            <?php } ?>
+        <?php } ?>
+    <?php } ?>
\ No newline at end of file
index e2922ea..ae24747 100644 (file)
@@ -1,58 +1,64 @@
-                
-                <div class="sidebar shop-sidebar">
+<div id="side-divide" class="medium-3 columns show-for-medium">
+</div>
+<div>
+    <?php echo get_template_part("parts/cats-and-products"); ?>
+</div>    
+
+
+<div class="sidebar shop-sidebar">
 <!--                    <h1>Test</h1>-->
-                    <?php
+    <?php
 //
-                        $taxonomy     = 'product_cat';
-                        $orderby      = 'name';  
-                        $show_count   = 0;      // 1 for yes, 0 for no
-                        $pad_counts   = 0;      // 1 for yes, 0 for no
-                        $hierarchical = 1;      // 1 for yes, 0 for no  
-                        $title        = '';  
-                        $empty        = 0;
+        $taxonomy     = 'product_cat';
+        $orderby      = 'name';  
+        $show_count   = 0;      // 1 for yes, 0 for no
+        $pad_counts   = 0;      // 1 for yes, 0 for no
+        $hierarchical = 1;      // 1 for yes, 0 for no  
+        $title        = '';  
+        $empty        = 0;
+
+        $args = array(
+               'taxonomy'     => $taxonomy,
+               'orderby'      => $orderby,
+               'show_count'   => $show_count,
+               'pad_counts'   => $pad_counts,
+               'hierarchical' => $hierarchical,
+               'title_li'     => $title,
+               'hide_empty'   => $empty
+        );
+       $all_categories = get_categories( $args );
+       foreach ($all_categories as $cat) {
+          if($cat->category_parent == 0) {
+              $category_id = $cat->term_id;       
+              echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';
 
-                        $args = array(
-                               'taxonomy'     => $taxonomy,
-                               'orderby'      => $orderby,
-                               'show_count'   => $show_count,
-                               'pad_counts'   => $pad_counts,
-                               'hierarchical' => $hierarchical,
-                               'title_li'     => $title,
-                               'hide_empty'   => $empty
-                        );
-                       $all_categories = get_categories( $args );
-                       foreach ($all_categories as $cat) {
-                          if($cat->category_parent == 0) {
-                              $category_id = $cat->term_id;       
-                              echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';
+              $args2 = array(
+                      'taxonomy'     => $taxonomy,
+                      'child_of'     => 0,
+                      'parent'       => $category_id,
+                      'orderby'      => $orderby,
+                      'show_count'   => $show_count,
+                      'pad_counts'   => $pad_counts,
+                      'hierarchical' => $hierarchical,
+                      'title_li'     => $title,
+                      'hide_empty'   => $empty
+              );
+              $sub_cats = get_categories( $args2 );
+              if($sub_cats) {
+                  foreach($sub_cats as $sub_category) {
+                      echo  $sub_category->name ;
+                  }   
+              }
+          }       
+      }
+      ?>
 
-                              $args2 = array(
-                                      'taxonomy'     => $taxonomy,
-                                      'child_of'     => 0,
-                                      'parent'       => $category_id,
-                                      'orderby'      => $orderby,
-                                      'show_count'   => $show_count,
-                                      'pad_counts'   => $pad_counts,
-                                      'hierarchical' => $hierarchical,
-                                      'title_li'     => $title,
-                                      'hide_empty'   => $empty
-                              );
-                              $sub_cats = get_categories( $args2 );
-                              if($sub_cats) {
-                                  foreach($sub_cats as $sub_category) {
-                                      echo  $sub_category->name ;
-                                  }   
-                              }
-                          }       
-                      }
-                      ?>
-                    
-                    <a href="<?php echo esc_url( get_permalink( woocommerce_get_page_id( 'shop' ) ) ); ?>">
-                        <h1>Products</h1>
-                    </a>
+    <a href="<?php echo esc_url( get_permalink( woocommerce_get_page_id( 'shop' ) ) ); ?>">
+        <h1>Products</h1>
+    </a>
 <!-- Adding parent_id="0" to the shortcode attributes below places it back the way it was, just showing top-level cats -->
-                    <?php echo do_shortcode('[product_categories number="" hierarchical="1" orderby="name" order="asc" columns="1" hide_empty="0" ids=""]'); ?>
-                </div>
+    <?php echo do_shortcode('[product_categories number="" hierarchical="1" orderby="name" order="asc" columns="1" hide_empty="0" ids=""]'); ?>
+</div>
 
 <script>
 jQuery(document).ready(function($) {
index 072ee80..9017561 100644 (file)
@@ -60,6 +60,9 @@
         padding: 0 10px;
     }
 }
+.sidebar {
+    padding: 0;
+}
 #side-nav {
     padding-top: 10px;
     background: #f2f9fc;
index 8903a6a..95c5be8 100644 (file)
@@ -714,6 +714,22 @@ h1.product_title {
 #front-shop .front-product-content-container {
     padding: 10px;
 }
+.side-product-wrapper {
+    margin-bottom: 36px;
+}
+.side-product-content-container {
+    h5 > a {
+        color: $green;
+        text-decoration: none;
+    }
+    ul {
+        margin: 0;
+        list-style: none;
+    }
+    li {
+        line-height: 2.25;
+    }
+}
 .shop-sidebar {
     list-style: outside none none;
     margin-left: 0;
index 348a38a..55de935 100644 (file)
@@ -1,9 +1,9 @@
                         <div class="row">
                             <div id="side-divide" class="medium-3 columns show-for-medium">
                             </div>
-                            <?php echo do_shortcode('[product_categories number="" orderby="name" order="asc" columns="2" hide_empty="0" parent="0" ids=""]'); ?>   
+                            
                             <div class="small-12 medium-9 columns sidebar text-center medium-text-left">
-                                <div id="event-list">
+<!--                                <div id="event-list">
                                     <h2>Event Dates:</h2>
                                     <h5>C-SUITE/Senior Leader Retreat</h5>
                                     <ul>
@@ -19,7 +19,8 @@
                                     <ul>
                                         <li><a href="#">November 17-18, 2016 – Galena, IL</a></li>
                                     </ul>
-                                </div>
+                                </div>-->
+                                <?php echo get_template_part("parts/cats-and-products"); ?>
                                 <div class="widget">
                                     <?php if ( is_active_sidebar( 'side-widget' ) ) : ?>
                                        <?php dynamic_sidebar( 'side-widget' ); ?>
index b3dd69a..c7e6b2f 100644 (file)
                                 ?>
                                 </div><!-- .main .woo-tags -->
                             <?php } else if (is_product()) { ?>
-                                <div class="small-12 medium-9 columns left main woo-single-product">
+                                <div class="small-12 medium-7 columns left main woo-single-product">
                                     <?php
                                             /**
                                              * woocommerce_before_main_content hook
                                     ?>
                                 </div><!-- main woo-single-product -->
                             <?php } ?>
-                                <div id="woo-sidebar" class="small-12 medium-3 columns right">
-                                    <?php include 'parts/shop-sidebar.php';?>    
+                                <div id="woo-sidebar" class="small-12 medium-5 columns">
+                                    <?php get_sidebar(); ?>    
                                 </div>
                             </div><!-- .row .content -->
                         </main>