Custom Fields – What’s wrong with my code?
-
I have a custom field that contains an address for each post, but I can’t figure out how to get it to show up. I want it to appear at the end of each post, if that post has a value for address. I have Thesis, so I usually use Open Hook. If it has to be placed somewhere else, where does it go?
This is what I’ve tried so far:
add_action(‘thesis_hook_after_post’, ‘address’);
I also tried some variations of these:
<?php
$address_values = get_post_custom_values(‘address’);
foreach ( $address_values as $key => $value ) {
echo “$key => $value (‘address’)”;
}?>
Get_Post_Custom
<?php$custom_fields = get_post_custom(0);
$address = $custom_fields[‘address’];
foreach ( $address as $key => $value )
echo $key . ” => ” . $value . “”;?>
Is there another line I need to add somewhere to make these work?
The topic ‘Custom Fields – What’s wrong with my code?’ is closed to new replies.