wordpress - sidebar を二つに。

Posted on 2006/05/26 金曜日

 『ESTO*』のsidebar を二つにしました。

 『ESTO*』のテーマは『simpla』(『If…else』でダウンロードが出来ます)。 sidebar が一つなのですが、記事数が増えるにつれてカテゴリー数もどんどん増えています。 だいぶ縦長のサイトになってしまって、見落とされるカテゴリーが増えてくるのでは、と思って今回二つに分けることとしました。

 やり方をちょっとまとめます。
 今回の前提条件として、『sidebarleft.php』と『sidebarright.php』を作成しています。

1.wp-include』配下の『template-functions-general.php』内の下記記述を変更・追加します。

function get_sidebar() {
if ( file_exists( TEMPLATEPATH . ‘/sidebar.php’) )
load_template( TEMPLATEPATH . ‘/sidebar.php’);
else
load_template( ABSPATH . ‘wp-content/themes/default/sidebar.php’);
}

これを、

function get_sidebarleft() {
if ( file_exists( TEMPLATEPATH . ‘/sidebarleft.php’) )
load_template( TEMPLATEPATH . ‘/sidebarleft.php’);
else
load_template( ABSPATH . ‘wp-content/themes/default/sidebar.php’);
}

function get_sidebarright() {
if ( file_exists( TEMPLATEPATH . ‘/sidebarright.php’) )
load_template( TEMPLATEPATH . ‘/sidebarright.php’);
else
load_template( ABSPATH . ‘wp-content/themes/default/sidebar.php’);

get_sidebarleft と get_sidebarright へと変更・追加します。

2.表示させたいページに、get_sidebarleft と get_sidebarright を追加

例)index.php

….
< ?php get_sidebarright(); ?>
< ?php get_sidebarleft(); ?>

< ?php get_footer(); ?>

3.スタイルシートの変更は任意で。

a)sidebar 関係のスタイルシートは一切変更していません。
b)wrap の width を 54em → 95em に変更しました。
 ※ブログ全体の幅を決めているコードは、テーマごとに違います。 『simpla』の場合は、wrap でしたのでその部分を変更しています。

以上です。

Blink It

No comments have been added to this post yet.

コメントをどうぞ

(必須)

(必須)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI