rin-wendy.com情侶模板的制作思路(一)

這個網站的布局很特別,首頁是三欄,左右不同的顏色,文章頁根據不同的作者顯示不同的顏色,頁面又是一種風格。

1. 首先區分頁面,首頁,作者A和作者B。

1
2
3
4
5
6
7
8
9
10
11
12
<?php if (is_page())  {
    $style_item = 'page';
} elseif (is_single()) {
    if ($post->post_author == '1') {
        $style_item = 'left';
    }
    elseif ($post->post_author == '2') {
        $style_item = 'right';
    }
} else {
    $style_item = 'normal';
} ?>

把定義的$style_item加在DIV框架內,以方便用CSS控制顯示。

1
< div id="page" class="wrap-<?php echo($style_item); ?>">

繼續閱讀