Show link with page names
You can show links with Pages names. That means target pages name. Let’s begin…
The code
//Show link with name
function link_ismi_getir($atts) { //Fonksiyon başlangıcı :)
extract(shortcode_atts(array(
'url' => '', //url="adress(with http://)"
), $atts));
$str = file_get_contents($url);
if(strlen($str)>0){ //if $str is bigger than "0"
preg_match("/\<title \>(.*)\< \/title\>/",$str,$title); //Target page's header.
$linkaname = '<a href="'.$url.'" target="_blank" title="'.$title[1].'">'.$title[1].'</a>'; //Link
return $linkaname; //Get link with $linkaname
}
}
add_shortcode('linkname', 'link_ismi_getir');
//Shortcode maker :)
Add this code into functions.php which file in your theme’s. After that you can use this shortcode with your posts.
[linkname url="http://yourtargeturl.com"]
The Sample is here (Turkish) Click
Simple isn’t it :)
