I want to create links + titles using custom filed.
What do I mean?
For example I have custom filed named: mylink1,mylink2,mylink3 (etc..)
mylink1 value is "Google|http://www.google.com
mylink2 value is "Facebook|http://www.facebook.com"
mylink3 value is "Twitter|http://www.twitter.com"
I want WordPress to display this codes on Single Post theme:
<a href="http://google.com">Google</a>
<a href="http://www.facebook.com">Facebook</a>
<a href="http://www.twitter.com">Twitter</a>
I want WordPress to display this code on Single Post theme on every mylinkX custom field value. How can I do that?
Sure, no problem :)
use this code..
<?php
$val = get_post_meta( get_the_ID(), 'mylink1', true );
// brake the link on half :)
$desc = substr( $val , 0, strpos($val, '|') ) ;
$href = substr( $val , strpos($val, '|') + 1 ) ;
// in your template show the link with structure!
echo "<a href='" . $$href . "'>" . $desc . "</a>";
if the start or end is not correct then index is off, let me know if that works..