I have made a custom template to show the posts in "Products" category in a single page.I have some custom fields.I need to show the values of the custom fields in the page. I have used the get_post_custom_values as the following but i get an error as
Warning: Invalid argument supplied for foreach() in C:\wamp\www\SampleSite\wp-content\themes\TwentyElevenChildTheme\products.php on line 11
The code for products.php is as follows.
<?php
/*
Template Name: Product Template
*/
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php $recent = new WP_Query("cat=4&showposts=10"); while($recent->have_posts()) :$recent->the_post();?>
<?php $key_values = get_post_custom_values("Description"); ?>
<?php foreach($key_values as $key => $value )?>
<?php echo "$key => $value("Description") <br />";?>
<?php endwhile; ?>
I am not getting what the error is.Someone please help in this