投稿者のアイコン追加

このブログのtheme はnitrous を使っている。
Add Local Avatar というプラグインを導入し、投稿者やコメントした者のアイコンを表示できるようにした。
Add Local Avatar をダウンロードしFTPでPlugins に放り込み、activate する。
Users にAvatar という項目ができるからこのページを開き、

If allowed, use this directory for user avatar uploads, e.g. /avatars.
Must have write access and is relative to/Library/WebServer/Documents.
Or, use legacy (v7.3 and lower) $_SERVER['DOCUMENT_ROOT'] method

とする。legacy method にチェックを入れる。root 権限で/Library/WebServer/Documents にavatars というdirectory を作成しパーミッションを777とする。
これでAdd Local Avatar が利用可能になる。
タイトルの横に投稿者のアイコンを表示させためには;
home.php の10行目
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h1>

を太字の部分を加えて変更した。
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a><class=”author comment-author vcard”><span class=”comment-avatar”><?php echo get_avatar($post->post_author, $size = ’36’); ?></span></h1>
つまり
<class=”author comment-author vcard”><span class=”comment-avatar”><?php echo get_avatar($post->post_author, $size = ’36’); ?></span>
を挿入したわけだ。
これで、投稿者のアイコンがタイトルのあとに出現する。登録していないユーザはMonster のアイコンがでてくる。
9月3日現在、以下のようにさらに変更してみた。
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?><font size=1 color=”red”><?php _e(‘投稿者’); ?> <?php if (get_the_author_url()) { ?><a href=”<?php the_author_url(); ?>” title=”<?php the_author(); ?>”><?php the_author(); ?></a><?php } else { the_author(); } ?></a><class=”author comment-author vcard”>
<span><?php echo get_avatar($post->post_author, $size = ’36’); ?></span></font></h1>
投稿者の名前が表示されないので、小さな赤字で表示するようにしたのだ。姑息な方法だ。
コメントを入力するページにも同じようにアイコンと投稿者を示すようにしようとして;
同様にarchive.php の10行目
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h1>
にも挿入。
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a><font size=1 color=”red”><?php _e(‘投稿者’); ?> <?php if (get_the_author_url()) { ?><a href=”<?php the_author_url(); ?>” title=”<?php the_author(); ?>”><?php the_author(); ?></a><?php } else { the_author(); } ?></a><class=”author comment-author vcard”>
<span><?php echo get_avatar($post->post_author, $size = ’36’); ?></span></font></h1>
む。なにもかわらない。
同様にpage.php の10行目
<h1><?php the_title(); ?></h1>
にも挿入。
<h1><?php the_title(); ?><font size=1 color=”red”><?php _e(‘投稿者’); ?> <?php if (get_the_author_url()) { ?><a href=”<?php the_author_url(); ?>” title=”<?php the_author(); ?>”><?php the_author(); ?></a><?php } else { the_author(); } ?></a><class=”author comment-author vcard”>
<span><?php echo get_avatar($post->post_author, $size = ’36’); ?></span></font></h1>
ありゃ、これもかわらない。
ともかくTitle を表示するページをかきかえればいいかと….   またあとでだ。

スーパーで豆腐を…

今日、ひるめし時、スーパーで豆腐をどうやって売っているのか知らないという、おめでたい方とおしゃべりした。信じられる?誰だと思う?しょっちゅう見る人だけど、某本センセではないよ。惑星と恒星の区別ができなかった宇宙人ともちがう。
子供のときは、豆腐屋のおじさんが売りにきて、鍋を持っていくとその鍋にいれてくれていたそうな。そりゃ一時代前はそうだったよね。それ以降豆腐を買ったことがないんだって。だからスーパーで豆腐をどのようにして売っているのかわからないんだって。
あー、また一人宇宙人を発見したのだ。Men in Black のような一瞬にして宇宙人を見たという記憶をなくす道具ないだろうか。宇宙人がこんなにたくさんいるということを信じたくないからな。