[resolved] Single Value from Custom Field (3 posts)

  1. Majestix
    Posted 9 years ago #

    Hi there,

    I'm using the coffee mod for the custom field but maybe this works with WordPress itself, too.

    This is pulling the Data as wanted with the plugin:
    <?php echo c2c_get_custom('Quelle', '| <span class="quelle"><a href="', '" target="_blank" rel="nofollow">Via</a></span>'); ?>

    I thought I can do the same with this:
    <? get_post_meta(the_ID(), "Quelle", $single = true); ?>
    But it actually doesn't work, I just get the postID. Is it possible to get a single custom field value with WordPress itself?


  2. MichaelH
    Posted 9 years ago #

    It's the_ID() you can't use that--that template tag just echo the ID of the 'current' post.

    Try this instead:
    <?php echo 'my meta ' . get_post_meta($post->ID, 'Quelle', 1); ?>

  3. Majestix
    Posted 9 years ago #

    Perfect, that works! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic