WordPress.org

Ready to get started?Download WordPress

Forums

Hyperlinks in metadata (2 posts)

  1. bunchofapes
    Member
    Posted 4 years ago #

    Hello

    I was helped earlier my MichaelH, thanks to him!

    Right now im using the code below to display my metadata:

    <?php
    $website= get_post_meta($post->ID, 'website_value', true);
    if ($website){
    echo 'Website: '.$website;
    }
    ?>

    My question is how do I make the website when it displays the link a hyperlink...?

    So basically in the WP admin you can put in 'www.mysite.com' and http://www.mysite.com will appear as a hyperlink in the metadata...

    Dave

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    <?php
    $website= get_post_meta($post->ID, 'website_value', true);
    if ($website){
    echo 'Website: <a href="http://'.$website.'">'.$website.'</a>';
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic