fixed syntax error in updating the post meta fields
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 28 Dec 2015 20:51:15 +0000 (15:51 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 28 Dec 2015 20:51:15 +0000 (15:51 -0500)
index.php
views/product_detail.php

index 59a82bc..2bddd44 100644 (file)
--- a/index.php
+++ b/index.php
@@ -122,7 +122,7 @@ function miproduct_features()
     global $post;
 
     // Noncename needed to verify where the data originated
-    $nonce = wp_create_nonce( 'miproductmeta-meta-noncename' );
+     $nonce = wp_create_nonce( 'miproductmeta-meta-noncename' );
     echo '<input type="hidden" name="miproductmeta-meta-noncename" id="miproductmeta-meta-noncename" value="' . $nonce . '" />';
     // get the features for the post
     $features = get_post_meta( $post->ID, 'miproduct_features', true );
@@ -151,8 +151,8 @@ function miproduct_related_products()
     global $post;
 
     // Noncename needed to verify where the data originated
-    //echo '<input type="hidden" name="miproductmeta_related_products_noncename" id="" value="';
-    //wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
+    echo '<input type="hidden" name="miproductmeta_related_products_noncename" id="" value="';
+    wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
     // get the features for the post
     $related_products = get_post_meta( $post->ID, 'miproduct_related_products', true );
     // output field
@@ -185,7 +185,7 @@ function miproduct_save_meta()
         return $post->ID;
     }
     $features         = filter_var( $_POST['miproduct_features'] );
-    $related_products = filter_var( $_POST['miproduct_features'] );
+    $related_products = filter_var( $_POST['miproduct_related_products'] ); 
     update_post_meta( $post->ID, 'miproduct_features', $features );
     update_post_meta( $post->ID, 'miproduct_related_products', $related_products );
 
index 22ad52b..d401563 100644 (file)
@@ -28,5 +28,7 @@ foreach ($tags as $tag){ ?>
     <?php
     setup_postdata( $product );
     the_content();
+    $meta = get_post_meta($product->ID);
+   
 ?>