imgタグで入っていたので、PHPでaタグに書き換えました。
下記のコードでテキストリンクに変更できました。
<?php function imgLink($html){
preg_match_all('/<img(.+?)>/', $html, $match);
for($i=0;$i<count($match[0]);$i++){
preg_match('(http:\/\/[a-z0-9/\-_.]+)',$match[0][$i],$url_match);
$url_link = '[<a href="'.$url_match[0].'">画像</a>]';
$html= str_replace($match[0][$i],$url_link,$html);
}
echo $html;
} ?>
<?php $post = get_post($post_id); imgLink(get_post_meta($post->ID, $key, true)); ?>
ありがとうございました。
ありがとうございます。
現在テンプレートは、
<?php $post = get_post($post_id); echo get_post_meta($post->ID, '$key,', true); ?>
というコードになっていますが、どのように変更したらよいでしょうか?