• 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:

    Get Post Custom Values

    <?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?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Fields – What’s wrong with my code?’ is closed to new replies.