2017/06/06
Wordpress
備忘録です。
月間アーカイブの表示変更方法です。
参考サイト
【WP】WordPressのアーカイブリストの「年月」表示をカスタマイズする
ウィジェットの月間アーカイブは一般設定の日付のフォーマットで変更しても「20xx年1月」と表示されます。
「20xx/1」に変更したい場合にはfunctions.phpに記述します。
// wp_get_archivesの年表記を置き換える
// ----------------------------------------------------------------------
function my_archives_link($html){
$html = str_replace('年',' / ',$html);
$html = str_replace('月','',$html);
return $html;
}
add_filter('get_archives_link', 'my_archives_link');
// アーカイブウィジェットの年表記を置き換える
// ----------------------------------------------------------------------
function my_archives( $html ){
$html = str_replace('年',' / ',$html);
$html = str_replace('月','',$html);
return $html;
}
add_filter( 'widget_archives_args','my_archives');
2026/11/07
神社
2026/11/06
AI
2026/11/05
Wordpress
ホームページ制作
2026/11/04
Mac
2026/11/03
AI