[WordPress]アーカイブ表記に「年」を追加

WordPress
スポンサーリンク

目次

functions.php

function my_archives_link($html){
	if(preg_match('/[0-9]+?<\/a>/', $html))
	$html = preg_replace('/([0-9]+?)<\/a>/', '$1年</a>', $html);
	if(preg_match('/title=[\'\"][0-9]+?[\'\"]/', $html))
	$html = preg_replace('/(title=[\'\"][0-9]+?)([\'\"])/', '$1年$2', $html);
	return $html;
	}
add_filter('get_archives_link', 'my_archives_link', 10);

コメント

タイトルとURLをコピーしました