Forums

[resolved] Read and rewrite a custom field (1 post)

  1. nandayo
    Member
    Posted 7 months ago #

    Hello,

    weird question:
    Currently I’m fetching something from a custom field to show it up on the post.

    Example: Custom field "URL":

    <p>URL:<a href="<?php echo get_post_meta($post->ID, "url", $single = true);?>"><?php echo get_post_meta($post->ID, "url", $single = true);?></a></p>

    So when I enter http://www.domain.com as a custom field, it shows up as http://www.domain.com on the published post. Perfect.

    But what if the URL is long and if I don’t want to use some tiny url creator?

    I would like to enter some long address (http://www.domain.com/directory/someaddress.html) in a custom field and it should shop up as "http://www.domain.com" (but the a href should be the real address).

    Is that possible? I sure know that I can truncate the address, but then it’s not usable...

    Anyone?
    Thanks!

Reply

You must log in to post.

About this Topic