get_post_custom(); doesn't work in loop, looking for work around…
-
Hi,
I’m trying to pull all the custom fields associate with a post. I can’t seem to do this. Basically here’s the code I’m using. Its straight from the codex, in the loop:
<?php $custom_fields = get_post_custom(); $my_custom_field = $custom_fields['my_custom_field']; foreach ( $my_custom_field as $key => $value ) echo $key . " => " . $value . "<br />"; ?>
I don’t know why this isn’t working. I’ve tried this as well: http://codex.wordpress.org/Function_Reference/get_post_custom_keys
which is fine for getting the keys, but when i get to the values, i can’t just pull a full list of values, it always wants a key.
Sooo….does anyone have either a suggestion as to why the codex code dosen’t work?
Or, perhaps another way to pull all the values?
I really need a hand with this, because I am totally stumped and have been trying to find a work around for ages.
<?php the_meta(); ?>
…works, but unfortunately I can’t format anything with it. Unless there is a filter i can toss in the functions file? That might help.so in short: HELP. Please?
Thank You
Nadine
- The topic ‘get_post_custom(); doesn't work in loop, looking for work around…’ is closed to new replies.