Display custom fields one value multiple times
-
Dear wordpress users,
I have been teasing my brain over this all evening but simply can not find an answer.
I have set up a custom field with the value “portdetail” I use this value
multiple times I would like to display it multiple times to.I have this code;
<?php $custom_fields = get_post_custom(); $my_custom_field = $custom_fields['portdetail']; foreach ( $my_custom_field as $key => $value ) echo "<li><img src='http://gdesignstudio.nl/wp-content/uploads/" . $value . "' /><li/>"; ?>This really works like a charm if I wouldt get this error;
Warning: Invalid argument supplied for foreach() in /usr/home/deb10155/domains/gdesignstudio.nl/public_html/wp-content/themes/GD/portfolio.php on line 36
I’m using this code within a “query_posts” but just cant find a way to get rid of the error.
Thank you all in forward for your answers.
greetings,
Hans van Wijk
The topic ‘Display custom fields one value multiple times’ is closed to new replies.