Created
October 15, 2012 08:27
-
-
Save gatespace/3891438 to your computer and use it in GitHub Desktop.
WordPress日付別アーカイブタイトルを修正
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 日付別アーカイブタイトルを修正 | |
* http://memo.dogmap.jp/2012/04/16/wordpress-fix-date-archive-title/ | |
*/ | |
function jp_date_archive_wp_title( $title ) { | |
if ( is_date() ) { | |
$title = ''; | |
if ( $y = intval(get_query_var('year')) ) | |
$title .= sprintf('%4d年', $y); | |
if ( $m = intval(get_query_var('monthnum')) ) | |
$title .= sprintf('%2d月', $m); | |
if ( $d = intval(get_query_var('day')) ) | |
$title .= sprintf('%2d日', $d); | |
$title .= ' | '; | |
} | |
return $title; | |
} | |
add_filter( 'wp_title', 'jp_date_archive_wp_title', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment