WordPress.org

Ready to get started?Download WordPress

Forums

get_post_custom_values problem (2 posts)

  1. RyanColins
    Member
    Posted 5 years ago #

    I'm using the custom fields to add a few things to posts.

    Example:
    <a href="<?php $values = get_post_custom_values("url"); echo $values[0]; ?>" title="<?php the_title(); ?>">

    Lets say my site is www.mysite.com. I choose to put in the custom field "url" the site www.othersite.com. That means the link in the example should direct there. But when I go to the post, when I hover over the link it displays as www.mysite.com/www.othersite.com. Same as when I click on the link.

    Now here is where it gets weird. If I go to view source on the browser and look at the code, it will show the link as <a href="www.othersite.com">posttitle</a>, not www.mysite.com/www.othersite.com.

    This is only occurring with the links where I use get_post_custom_values. Other links on the page are unaffected.

    I am utterly lost on this one. Anyone got any ideas?

  2. Tom(dB)
    Member
    Posted 5 years ago #

    you need http:// before your "url" value.

Topic Closed

This topic has been closed to new replies.

About this Topic