changed ancestors to terms
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 22 Dec 2015 18:21:06 +0000 (13:21 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 22 Dec 2015 18:21:06 +0000 (13:21 -0500)
views/product_detail.php

index 7585d12..b6718f2 100644 (file)
@@ -1,16 +1,17 @@
 <?php
-$array = get_post_ancestors($product->ID);
-$relatives = array_reverse($array);
-    ?>
+$args = array(
+    'hierarchical'=> true,
+
+);
+$array = wp_get_post_terms($product->ID, 'michsci_category', $args);
+$relatives = array_reverse($array);?>
 <?php foreach($relatives as $relative){
-    $relative_post = get_post($relative);
-    echo '<a href="#">' . $relative_post->post_name . '</a>' . " > " ;
+    echo "<a href='#'>" . $relative->name . "</a>" . " > ";
 } ?>
 <?php echo $product->post_title; ?>
 <h2><?php echo $product->post_title; ?></h2>
     <?php
     setup_postdata( $product );
     the_content();
-    
 ?>