Donate page url grabbed from category name
authorLaury GvR <laury@gaslightmedia.com>
Tue, 16 Feb 2016 20:04:41 +0000 (15:04 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 16 Feb 2016 20:04:41 +0000 (15:04 -0500)
functions.php
header.php

index 21fad21..52fcd4f 100644 (file)
@@ -302,6 +302,12 @@ function glm_get_background() {
     return $imageUrl; 
 }
 
+function get_product_category_by_id($cat_id) 
+{
+    $category = get_term_by('id', $cat_id, 'product_cat', 'OBJECT');
+    return $category; 
+}
+
 // // The code below is useful when you want the image to resize to
 //    if (has_post_thumbnail()) {
 //            $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
index 242e025..be88721 100644 (file)
@@ -29,9 +29,9 @@
                                             <?php if($memberPage):?>
                                             <li><a href="<?php echo get_page_link($memberPage->ID);?>">Memberships</a></li>
                                             <?php endif;?>
-                                            <?php $donationsPage = get_post(199);?>
+                                            <?php $donationsPage = get_product_category_by_id(11);?>
                                             <?php if($donationsPage):?>
-                                            <li><a href="<?php echo get_page_link($donationsPage->ID);?>">Donate</a></li>
+                                            <li><a href="<?php bloginfo('url');?>/product-category/<?php echo $donationsPage->slug;?>"><?php echo $donationsPage->name;?></a></li>
                                             <?php endif;?>
                                             <?php $blog = get_post(203);?>
                                             <?php if($blog):?>