Forums

[resolved] Embedded links in custom field (3 posts)

  1. ThorHammer
    Member
    Posted 2 years ago #

    Hi, is it possible to put embedded links as custom field values?

    like: Link 1, Link 2

    I only get echoed with "Array", since the custom field value reminds about an array, sort of. I need a workaround to get this to work. Anyone who can help me with any hint?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    If custom field is present, formulate and display link from meta value

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

    MichaelH: Thanks! You probably saved my night! :-)

Topic Closed

This topic has been closed to new replies.

About this Topic