Skip to content

Instantly share code, notes, and snippets.

@gatespace
Created October 15, 2012 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatespace/3891438 to your computer and use it in GitHub Desktop.
Save gatespace/3891438 to your computer and use it in GitHub Desktop.
WordPress日付別アーカイブタイトルを修正
<?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