Forums

[resolved] Extreme challenge -custom fields value (3 posts)

  1. ThorHammer
    Member
    Posted 2 years ago #

    I need to have several links listed from my custom fields. With the script below I can output one url and the link text. But, If I duplicate the custom field value, it still only echoes the first input. How to mod this script in order to output several custom field values?

    <?php
    $link = get_post_meta($post->ID, 'link_url', true);
    $text = get_post_meta($post->ID, 'link_text', true);
     if ($link){
    echo '&nbsp;&middot; <a href="'.$link .'">'.$text.'</a>&nbsp;';
    }
    ?>
  2. ThorHammer
    Member
    Posted 2 years ago #

    Ok, forget it, I don't think this is possible.

  3. alchymyth
    The Sweeper
    Posted 2 years ago #

    'true'

    that is not the answer, that is the parameter that needs changing:

    Return Value
    If $single is set to false, or left blank, the function returns an array containing all values of the specified key.
    If $single is set to true, the function returns the first value of the specified key (not in an array)

    http://codex.wordpress.org/Function_Reference/get_post_meta

Topic Closed

This topic has been closed to new replies.

About this Topic