added advanced custom field for itineraries and changed category display in sidebar
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 24 Jun 2016 19:33:26 +0000 (15:33 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 24 Jun 2016 19:33:26 +0000 (15:33 -0400)
functions.php
sidebar.php

index 80ea695..28f7e23 100644 (file)
@@ -48,28 +48,31 @@ add_filter( 'woocommerce_product_tabs', 'woo_product_tab_edits' );
 
 function woo_product_tab_edits( $tabs ) {
         // to always have the WooCommerce product inquiry tab display
-    $tabs['product_inquiry_tab'] = array(
+    $tabs[ 'product_inquiry_tab' ] = array(
         'title'     => __( 'Enquire', 'woocommerce' ),
-        'priority'  => 50,
         'callback'  => 'woo_product_inquiry_content'
     );
-    $tabs['intinerary_tab'] = array(
+    $tabs[ 'itinerary_tab' ] = array(
         'title'     => __('Itinerary', 'woocommerce'),
-        'priorty'   => 20,
         'callback'  => 'woo_itinerary_content'
     );
-    $tabs['photos_tab'] = array(
+    $tabs[ 'photos_tab' ] = array(
         'title'     => __('Photos', 'woocommerce'),
-        'priorty'   => 5,
         'callback'  => 'woo_photos_content'
     );
     
-    unset( $tabs['reviews']);
-    unset( $tabs['additional_information']);
-    
-    $tabs['description']['priority'] = 10;
+    unset( $tabs[ 'reviews' ]);
     
+    unset( $tabs[ 'additional_information' ]);
+//    
+    $tabs[ 'photos_tab' ][ 'priority' ] = 5;
+    $tabs[ 'description' ][ 'priority' ] = 10;
+    $tabs[ 'itinerary_tab' ][ 'priority' ] = 20;
+    $tabs[ 'html5_video' ][ 'priority' ] = 30;
+    $tabs[ 'product_inquiry_tab' ][ 'priority' ] = 40;
+
     return $tabs;
+    
 }
 
 function woo_product_inquiry_content() {
@@ -79,8 +82,9 @@ function woo_product_inquiry_content() {
 
 function woo_itinerary_content() {
     global $product;
-    echo do_shortcode('[gravityform id="3" title="true" description="true"]');
+    echo the_field('itinerary');
 }
+
 function woo_photos_content() {
     global $product;
     
@@ -88,25 +92,8 @@ function woo_photos_content() {
 
     foreach( $attachment_ids as $attachment_id ) 
     {
-//      //Get URL of Gallery Images - default wordpress image sizes
-//      echo $Original_image_url = wp_get_attachment_url( $attachment_id );
         $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
-//      echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0];
-//      echo $thumbnail_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail' )[0];
-//
-//      //Get URL of Gallery Images - WooCommerce specific image sizes
-//      echo $shop_thumbnail_image_url = wp_get_attachment_image_src( $attachment_id, 'shop_thumbnail' )[0];
-//      echo $shop_catalog_image_url = wp_get_attachment_image_src( $attachment_id, 'shop_catalog' )[0];
-//      echo $shop_single_image_url = wp_get_attachment_image_src( $attachment_id, 'shop_single' )[0];
-
-      //echo Image instead of URL
-//      echo wp_get_attachment_image($attachment_id, 'full');
-//      echo wp_get_attachment_image($attachment_id, 'medium');
-//      echo wp_get_attachment_image($attachment_id, 'thumbnail');
         echo '<div class="product_gallery_images" style="background: url(' . $full_url . ') no-repeat center center; background-size: cover;" ></div>'; 
-//       echo '<div class="product_gallery_images">'. wp_get_attachment_image($attachment_id, 'shop_thumbnail'). '</div>';
-//      echo wp_get_attachment_image($attachment_id, 'shop_catalog');
-//      echo wp_get_attachment_image($attachment_id, 'shop_single');
     }
 }
 
@@ -121,6 +108,7 @@ function gform_add_product_name_field( $value ) {
         $id = $post->ID;
         $product_meta = new WC_Product($id);
         $title = $product_meta->get_title();
+        $title = str_replace(' ', '-', $title);
     }
 
     if ($title){
index 41abe57..7bad6f6 100644 (file)
@@ -3,6 +3,7 @@
     $product_meta = new WC_Product($id);
     $sku = $product_meta->get_sku();
     $title = $product_meta->get_title();
+    $title = str_replace(' ', '-', $title);
 ?>
 
 <div id="sidebar-category">