I love the way smartArchives displays the archives of your blog. I’ve set it up on my site at the bottom of the page - just before the sidebars.
Following the instructions on the plugin page makes it pretty easy to set up, but here is what I did in case you’re curious.
First, I put the necessary code where I wanted the archives to show up. In my case, I changed the Main Index Template (index.php file) of the T1 theme. I browsed down just below the closing div of the <div id="nav-below"> section. After that entire section and just before the </div><!-- #content -->, I put the following:
<div class="smartArchives" >
<?php if (function_exists('smartArchives')) {
echo ('<span class="smartArchives_title">Archives</span><br />');
smartArchives('block','');
} ?>
</div>
This will keep the code from breaking the site in case the plugin is not installed or activated.
Now I had to style it for my site. For this, I just added the following to my custom.css file of the T1 theme.
.smartArchives { margin: 10px 25px; clear: both; }
.smartArchives span.smartArchives_title { font-weight: bold; }
.smartArchives a:hover { background: #26466d; color: #fff; }
.smartArchives .emptymonth { display: none; }
Of course you can place the archives wherever you want and style it to fit your needs.
Although the “block” display is not very helpful for the visitors, I like how it looks. I’ll probably implement the “list” style on the actual archives page. This will display the title of the posts and be a lot more helpful for the visitors.



One Trackback
[...] 这里是第三方介绍的使用CSS自己去美化这个页面。 [...]