Home » Thủ thuật blog
Tiện ích hiển thị số bài viết và số bài comment
Thứ Tư, 22 tháng 4, 2009
Thủ thuật này có lẽ không mới lạ gì so với blogger, nên mình sẽ không giới thiệu gì nhiều.
Trước tiên thực hiện thủ thuật này thì blog của bạn phải dược kích họat chức năng RSS Feed từ trước.
Hình minh họa:

Sau đây là cách thực hiện:
1. Tạo 1 Widget HMTL/Javascript
2. Dán đọan code bên dưới vào widget, và di chuyển đến nơi muốn hiển thị, save template lại.
Code:
<script style=”text/javascript”>
function numberOfPosts(json) {
document.write(’Total Posts: <b>’ + json.feed.openSearch$totalResults.$t + ‘</b><br>’);
}
function numberOfComments(json) {
document.write(’Total Comments: <b>’ + json.feed.openSearch$totalResults.$t + ‘</b><br>’);
}
</script>
<ul><li><script src=”http://yourblog.blogspot.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts”></script></li>
<li><script src=”http://yourblog.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments”></script></li></ul>
function numberOfPosts(json) {
document.write(’Total Posts: <b>’ + json.feed.openSearch$totalResults.$t + ‘</b><br>’);
}
function numberOfComments(json) {
document.write(’Total Comments: <b>’ + json.feed.openSearch$totalResults.$t + ‘</b><br>’);
}
</script>
<ul><li><script src=”http://yourblog.blogspot.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts”></script></li>
<li><script src=”http://yourblog.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments”></script></li></ul>
Chú ý: thay đổi các code màu đỏ thành nhưng link của bạn. Code màu xanh có thể tùy chỉnh theo ý bạn.
Như vậy đã xong.
Nguồn Blog Solid

- Bài viết liên quan cho blogspot - Hiệu ứng ảnh thu nhỏ
- Thủ thuật thêm thống kê Blog 3 trong 1 cho blogspot
- Giải pháp Blogger bị chặn 02/07/2012
- Các truy vấn cơ bản với Blogspot
- Nâng cấp ANC Gdata lên phiên bản 2.
- Hướng dẫn config domain cho hầu hết các mạng.
- Khắc phục hiện tượng chặn web của VNPT.
- Giải pháp VNPT chặn blogger ngày 09/06/2012
- Tạo thumb cho bài đăng phổ biến
- Tạo lại header cho chuẩn Seo
- BlogSpot cải thiện tính năng SEO cho blog
- ANCKeywords - Tự động cập nhập keywords từ người dùng cho site.
Comments[ 0 ]
Đăng nhận xét