最近手癢又開始想要改東改西,今天不小心去逛到一個很多theme的網站,發現其中的一個theme有讓首頁的最新文章出現最新LOGO的寫法,基於mashup的風潮,所以要混搭,因此就把這功能給A了過來(我承認我很愛A東西XD),改法很簡單,幾個步驟就能夠搞定。

效果就如同敝站的首頁效果 – http://edblog.net

修改步驟1 – index.php

<?php while (have_posts()) : the_post(); ?>

請在這下方加入一段語法

<div class="<?php if(is_home() && $post==$posts[0] && !is_paged()) echo ' firstpost';?>">

之後請在

<?php endwhile; ?>

上方多加一個

</div>

修改步驟 2 – css
請在css檔案裡面增加下面這一段

.firstpost {
background-image: url(i/latest.gif); /*背景圖片位置*/
background-repeat: no-repeat; /*背景圖片不重複*/
background-position: right top; /*背景圖片出現位置, 預設為右上*/
}

修改步驟 3 – 自備一個最新圖案,若暫時沒有可以A我的 XD Latest

之後重新讀取首頁即可獲得此效果。

Tags: , ,
Trackback:
也許你也對以下文章有興趣: