The MU forums have moved to WordPress.org

Using custom fields in the template (2 posts)

  1. DannyM
    Member
    Posted 14 years ago #

    I'm attempting to use the get_post_custom_values() function to retrieve a custom field for a post titled "news-image".

    I want to use this variable as the src attribute for an <img />

    Here is my code:

    <?php
       $imgSrc = get_post_custom_values('news-image');
    ?>
    <img src="<?php echo $imgSrc[0]?>" />

    In the HTML the src continues to be null. You can view my page at http://metroiceblog.net

    What am I doing wrong?

  2. parkstreet
    Member
    Posted 14 years ago #

    Scroll to the bottom of this post. It may give you some idea on how to change your above syntax so that it works.

About this Topic

  • Started 14 years ago by DannyM
  • Latest reply from parkstreet