まとめ
customizer.phpのget_copylight_credit()を以下のように編集。変更しているのは最後のreturn~のところのみ。
//Copyright表示
function get_copylight_credit($should_show_date = true){
//サイト名のみ
$site_tag = get_bloginfo('name');
//
$year = '';
if ( $should_show_date ) {
$year = get_first_post_year();
}
//サイト名とリンク
$site_tag = ' <a href="'.home_url().'">'.get_bloginfo('name').'</a>';
return '© '.$year.' - '.date("Y").' '.$site_tag;
}
内容
外観→テーマの編集 からfooter.phpを見ると
<div class="credit">
<?php echo get_site_license(); //サイトのライセンス表記の取得 ?>
</div>
となっている。ここを直接変更してもよいがせっかくなのでget_site_license()をたどって関数を編集する。
customizer.phpを見るとget_site_license()からget_copylight_credit()が呼び出されていることが分かる。
get_copylight_credit()は
//Copyright表示
function get_copylight_credit($should_show_date = true){
//サイト名のみ
$site_tag = get_bloginfo('name');
//
$year = '';
if ( $should_show_date ) {
$year = get_first_post_year();
}
//サイト名とリンク
$site_tag = ' <a href="'.home_url().'">'.get_bloginfo('name').'</a>';
return '© '.$year.' '.$site_tag;
}
となっているので、get_first_post_year()に対するget_latest_post_year()みたいな最終投稿年取得関数を作っても良いが、面倒なので現在の年取得date(“Y”)を使う。
return '© '.$year.' - '.date("Y").' '.$site_tag;
これでクレジット表記が最初の投稿日から現在の年までになる。