WordPress でアーカイブページを表示した時の、<title></title> に関する話です。

このブログではテーマの header.php で wp_title('-', false) としているため、ブラウザのタイトルバーに "2007 - 4月" と表示されますが、これを "2007年 - 4月" としてみました。

"2007" の表記が西暦を表すのは自明なので、'年' の付加は、ほとんど気分の問題ですね。という事で、header.php の以下の箇所を

<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

下記のように書き換えました。

<?php
  if (is_archive() && !is_category())
    $title = mberegi_replace(" ([0-9]{4}) ", " \\\\1年 ", wp_title('-', false));
  else
    $title = wp_title('-', false);
?>
<title><?php bloginfo('name'); ?><?php echo $title; ?></title>

表示しているページがアーカイブであってカテゴリーではないという条件の時に、wp_title() で得られた文字列の、前後を半角の空白に挟まれた 4桁の数字を、その数字に '年' を足した文字列で置換する、というベタな方法です。

今回は、WordPress の勉強という意味で テーマの header.php 内に直接コードを書きましたが、本来はプラグインで実現すべき内容なので、課題にしたいと思います。

Zithromax

Lexapro

Male Enhancement
Speman

Purchase Norvasc

Cephalexin

Abana
Levitra

Rhinocort
Purchase Oxycontin

Yerba Diet
Purchase Nimotop

Zebeta

Purchase Alprazolam

Propecia

Quibron-T

Purchase StretchNil
Aceon

Purchase Styplon

Loxitane

Purim

Purchase Oxytrol
Purchase Proscar
Flagyl ER

Norpace CR
Clomid

Purchase Lexapro
Cystone
Purchase Cymbalta

Micardis
Purchase Clarinex

StretchNil

Cardura
Femara

Ashwagandha

Purchase Lioresal
Purchase Aricept

Purchase Mentax

Purchase Levitra

Koflet

Purchase Parlodel
Purchase Acyclovir

Glucophage

Lortab

Purchase Micardis

Epivir-HBV

Acticin

Purchase Zestril

Dostinex
Imitrex
Ventolin

Meridia
Purchase Brite
Penisole
Purinethol

Codeine

Purchase Serevent

Purchase Kamagra
Purchase Lincocin
Purchase Requip

Lotrisone

Purchase Zebeta

Purchase Actos

Purchase Zocor

Purchase Omnicef
Purchase Stromectol
Glucotrol XL
Plavix
Topamax

Lamisil
Purchase Cyklokapron
Purchase Zyloprim

Purchase Flexeril

Zimulti
Purchase Codeine

Prograf

Purchase Copegus

Himcospaz
Purchase Prograf

Purchase Famvir
Menosan
Purchase Penisole
Herbal Phentermine

Zelnorm

Purchase Prandin

Ambien
Purchase Percocet

Viagra Jelly
Xeloda

Purchase Lamisil

Diabecon

Synthroid
Parlodel
Purchase Rocaltrol
Coumadin
Purchase Imitrex

Zyvox
Purchase Xenacore
Purchase Sumycin

Purchase Coumadin

Zyban
Feldene
Ismo
Purchase Gasex

Sustiva
Tentex Forte

Hytrin
Adalat
Cytotec

Purchase Rhinocort

Lamictal

Purchase Starlix

Purchase Mobic
Purchase Clarina
Purchase Nizoral

Purchase High
Purchase Evista

Sarafem
Women Attracting

Ultram
Purchase Pamelor

Altace

Purchase Darvocet
Sorbitrate

Stromectol
Tentex Royal

Purchase Amaryl

Evista

Purchase Zithromax
Purchase Hyzaar