custom fields erros when no value available
-
I’ve set up posts to have several relevant custom fields.
each post may use a few or all of the fields that i’ve set up. however when a post has no need for some of the fields and i have not used them, i can see an error message appear for that particular line on the page.i have added a conditional statement for each but the error message seems to still prevail.
the code looks something like this
<?php if (empty ($custom_fields) ) { echo ""; } else { $custom_fields = get_post_custom(); $Track1 = $custom_fields['Track13']; foreach ( $Track13 as $key => $value ) echo $value . "<br />"; } ?>
and the error i get is like this relating to the foreach
Warning: Invalid argument supplied for foreach() in /content/BusinessHostPlus/b/u/burntprogress.com/web/promo/wp-content/themes/burntpromo/single.php on line 260
any idea what i’m doing wrong?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘custom fields erros when no value available’ is closed to new replies.