We have custom field for example:
Custom Field Name:SingleProduct
Custom Field Value:12345
Now we will see how we can store values using get_post_custom_values(“Custom Field Name”) function.
<?php
$values = get_post_custom_values("SingleProduct");
if (isset($values[0])) {
$SingleProduct = $values[0];
} ?>
Here $values is array. get_post_custom_values function stores custom field values in array.
And then the $values[0] is stored in $SingleProduct variable.
0 comments:
Post a Comment