• I want to have the ability to call the post’s custom field values in the loop on a page.

    Say I have a post for a record release and in the custom fields i store values for artist, release, tracklist, etc…

    Now on the page “Releases” I have this code to call some of these values:

    <h2>Latest Release</h2>
    <?php $featured_query = new WP_Query('category_name=release&posts_per_page=2');
    while ($featured_query->have_posts() ) : $featured_query->the_post(); ?>
    <div id="latestrelease">
    <div id="latestrelease_player">
    <?php echo get_post_meta($post->ID, 'artist', true) ?>
    </div>
    <div id="latestrelease_info">
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    <div class="buy_links"><span class="underline">Buy:</span> <a href="http://www.beatport.com/" title="Buy on Beatport" target="_blank">Beatport</a>, <a href="http://www.itunes.com/" title="Buy in iTunes" target="_blank">iTunes</a></div>
    </div>
    </div>
    <?php endwhile; ?>

    Why is the meta-value not displaying? If i call the_meta it’s getting displayed, why not seperately? How can I fix this?

    EDIT: I use the WordPress HTML (not visual) editor for the code and PHP execution plug-in.

  • The topic ‘Post custom field values not displaying on page’ is closed to new replies.