Read and rewrite a custom field
-
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 https://www.domain.com as a custom field, it shows up as https://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 (https://www.domain.com/directory/someaddress.html) in a custom field and it should shop up as “https://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!
- The topic ‘Read and rewrite a custom field’ is closed to new replies.