PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Calling Custom Fields outside Post Content Template

  1. Anonymous
    Unregistered

    I'm currently using the Post Content Template functionality to successfully display populated custom fields in the post body content.

    What I'm also trying to do is display a selected number of custom fields on a homepage teaser using the standard custom field syntax within the loop:

    <?php echo get_post_meta($post->ID, "asking-price", true); ?>

    For some reason I can't get it to work.

    Custom fields are there, see screen shot here ( http://yfrog.com/b5cymp) but for some reason the get_post_meta function is not returning the value.

    Could there be something I'm missing here? If the custom field was successfully submitted to the post, then there should be no problem calling it to display anywhere on the site I choose, just like any other custom field, correct?

    Here is my code:

    </tbody>
    <td class="label">Asking Price:</td>
    <td class="value"><?php echo get_post_meta($post->ID, "asking-price", true); ?></td>
    </tr>
    <tr>
    <td class="label">Estimated Rehab Cost:</td>
    <td class="value"><?php echo get_post_meta($post->ID, 'rehab-cost', true); ?></td>
    </tr>
    <tr>
    <td class="label">Potential Profit:</td>
    <td class="value"><?php echo get_post_meta($post->ID, 'potential-profit', true); ?></td>
    </tr>
    </tbody>
    Posted 14 years ago on Friday November 5, 2010 | Permalink