現在位置: Top/WordPressの改造

WordPressの改造

個別記事のリンクをMovableTypeと同じにする

  1. wp-includes/template-functions-links.phpを編集する
    29行目
    $rewritereplace = 
    array(
    	date('Y', $unixtime),
    	date('m', $unixtime),
    	date('d', $unixtime),
    	date('H', $unixtime),
    	date('i', $unixtime),
    	date('s', $unixtime),
    	$post->post_name,
    	$post->ID,
    	$category,
    	$author,
    	$post->post_name,
    );
    のなかの
    $post->ID,
    sprintf("%06d",$post->ID),
    とする。
  2. パーマリンクの設定
    「オプション」→「パーマリンク設定」
    「独自表記を以下の入力欄に記述」を選択し、
    「カスタム構造」に
    /archives/%post_id%.html
    と入力する。
  • ゼロでパディングされた記事番号のリンクが生成されますが、ゼロのまま値を渡しても記事番号として認識します。