Hiển thị bài viết theo danh mục tại trang chủ cho blogspot


Sau đây BSW sẽ hướng dẫn các bạn gọi các bài viết theo nhãn ra trang chủ. Bạn có thẻ sử dụng để gọi các bài viết theo danh này tại trang chủ hoặc sử dụng trên cả Sidebar của Blogspot.

Đây là bài viết đầu tiên của chuyên mục Blogspot Catelogy (Hiển thị bài viết theo nhãn) mời các bác theo dõi

Hiển thị bài viết theo danh mục tại trang chủ cho blogspot
Hiển thị bài viết theo danh mục tại trang chủ cho blogspot
Thủ thuật blogspot sẽ gọi bài viết ra trên trang chủ của Dessktop, bạn có thể sử thẻ điều kiện lại!

Code gọi bài viết theo nhãn blogspot từ BSW

<b:if cond='data:blog.url == data:blog.homepageUrl and data:blog.isMobileRequest == &quot;false&quot; or data:blog.pageType == &quot;item&quot;'>
<style type='text/css'>
/* Recent Post by Label home - bacsiwindows */
#home-rc2-bsw{overflow: hidden;margin: 0 0 20px;}
#BSW-rc-label1-wrapper{border-bottom:1px solid #eee;width:100%;float:left;margin:0 0 10px}
#home-rc2-bsw .BSW-rc-label1 ul,.BSW-rc-label2 ul{list-style:none;margin:0;padding:0}
#home-rc2-bsw .BSW-rc-label1 li,.BSW-rc-label2 li{margin:0;padding:0}
#home-rc2-bsw .BSW-rc-label1 .widget,.BSW-rc-label2 .widget{width:700px;max-width:100%;margin:0;padding:0}
#home-rc2-bsw .BSW-rc-label1 .widget-content,.BSW-rc-label2 .widget-content{padding:0;margin:0 0 10px;word-wrap:break-word;overflow:hidden}
#home-rc2-bsw .BSW-rc-label1 h2,.BSW-rc-label2 h2,.BSW-rc-label3 h2{position:relative;margin:5px 0;padding:5px 15px;font-size:14px;font-weight:700;text-transform:uppercase;color:#58a12b;clear:both;border-left:3px solid;background:#eee;display:inline-block}
#home-rc2-bsw .BSW-rc-label1 h2:after{content:&#39;&#39;;position:absolute;top:0;right:-25px;width:0;height:0;border-left:14px solid #eee;border-right:14px solid transparent;border-bottom:14px solid transparent;border-top:14px solid transparent}
#home-rc2-bsw .BSW-rc-label2 h2,.BSW-rc-label3 h2{margin:20px 0 0 0}
#home-rc2-bsw .BSW-rc-label2 h2:before{content:&#39;\f10b&#39;;right:10px;bottom:0;font-family:FontAwesome;font-style:normal;font-weight:normal;margin:0 10px 0 0;color:#ff675c}
#home-rc2-bsw .BSW-rc-label3 h2:before{content:&#39;\f143&#39;}
#home-rc2-bsw .BSW-rc-label1 .index,.BSW-rc-label2 .index{font-size:10px;float:right;font-weight:400}
#home-rc2-bsw .BSW-rc-label1 .index a,.BSW-rc-label2 .index a{display:flex;color:#039be5;padding:3px 8px;border-radius:2px;font-weight:400;border:1px solid #29b6f6}
#home-rc2-bsw .BSW-rc-label2 .index a{color:#ef6c00;border-color:#ffa726}
#home-rc2-bsw .BSW-rc-label1 .index a:hover{background:#039be5;color:#fff;border-color:transparent}
#home-rc2-bsw .BSW-rc-label2 .index a:hover{background:#ef6c00;color:#fff;border-color:transparent}
#home-rc2-bsw .BSW-rc-label1 .index a:after{content:&quot;\f105&quot;;font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;padding-left:5px}
#home-rc2-bsw .BSW-rc-label2 .index a:after{content:&quot;\f105&quot;;font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;padding-left:6px}
#home-rc2-bsw .BSW-rc-label2 span.BSW-rc-_meta_comment a:hover{color:#38761d!important}
#home-rc2-bsw .BSW-rc-label2 ul.BSW-rc-_thumbs li a:hover,.BSW-rc-label2 ul.BSW-rc-_thumbs2 li a:hover{color:#ff675c;text-decoration:none}
#home-rc2-bsw .BSW-rc-_left{float:left;margin:0;padding:0;width:60%}
#home-rc2-bsw .BSW-rc-_right{width:38%;height:440px;overflow:auto;float:right;margin-left:2%;box-sizing:border-box}
#home-rc2-bsw .BSW-rc-_right::-webkit-scrollbar{width:4px}
#home-rc2-bsw .BSW-rc-_right::-webkit-scrollbar-thumb{background:#ccc}
#home-rc2-bsw .BSW-rc-_right::-webkit-scrollbar-thumb:active{background:#bbb}
#home-rc2-bsw ul.BSW-rc-_thumbs{margin:0;padding:0}
#home-rc2-bsw ul.BSW-rc-_thumbs div.bsw-rc-in4{padding:0 14px 14px}
#home-rc2-bsw ul.BSW-rc-_thumbs li,ul.BSW-rc-_thumbs2{margin:0;padding:0}
#home-rc2-bsw ul.BSW-rc-_thumbs .cat_thumb{position:relative;margin:0 0 15px;padding:0;width:100%;height:260px}
#home-rc2-bsw ul.BSW-rc-_thumbs .cat_thumb img{height:100%;width:100%;object-fit:cover}
#home-rc2-bsw ul.BSW-rc-_thumbs .cat_thumb img:hover{opacity:.9}
#home-rc2-bsw ul.BSW-rc-_thumbs2 li{margin:0 0 10px;padding:0}
#home-rc2-bsw ul.BSW-rc-_thumbs2 li .bsw-inf4{padding:10px}
#home-rc2-bsw ul.BSW-rc-_thumbs2 li:last-child{margin:0}
#home-rc2-bsw ul.BSW-rc-_thumbs2 .cat_thumb2{margin:0;width:100%;height:150px;overflow:hidden}
#home-rc2-bsw ul.BSW-rc-_thumbs2 .cat_thumb2 img{height:100%;width:100%}
#home-rc2-bsw ul.BSW-rc-_thumbs2 .cat_thumb2 img:hover{opacity:.8}
#home-rc2-bsw span.BSW-rc-_title{font-size:20px;font-weight:700;display:block;margin:0 0 10px;line-height:1.35}
#home-rc2-bsw span.BSW-rc-_title2{font-size:16px;margin:0 0 5px;font-weight:700}
#home-rc2-bsw span.BSW-rc-_title a{color:#333}
#home-rc2-bsw span.BSW-rc-_title a:hover{color:#ff675c;text-decoration:none}
#home-rc2-bsw span.BSW-rc-_summary{display:block;line-height:1.5em;font-size:14px;text-overflow:ellipsis;margin:10px 0 0 0}
#home-rc2-bsw span.BSW-rc-_meta{display:block;font-family:&#39;Roboto Condensed&#39;,sans-serif;font-size:11px;font-weight:400;color:#aaa;text-transform:uppercase}
#home-rc2-bsw span.BSW-rc-_meta a{color:#aaa!important;font-size:12px!important;display:inline-block}
#home-rc2-bsw span.BSW-rc-_meta_date,span.BSW-rc-_meta_comment,span.BSW-rc-_meta_more{display:inline-block;margin-right:10px}
#home-rc2-bsw span.BSW-rc-_meta_comment a:before{content: &quot;\f4ad&quot;; font-family: &#39;FontAwesome&#39;; font-style: normal; font-weight: 500; text-decoration: inherit; padding-right: 5px;}
#home-rc2-bsw span.BSW-rc-_meta_comment a:hover{color:#ff675c!important}
#home-rc2-bsw span.BSW-rc-_meta_date:before{content:&quot;\f133&quot;;font-family:&#39;FontAwesome&#39;;font-style:normal;font-weight:normal;text-decoration:inherit;padding-right:5px}
#home-rc2-bsw ul.BSW-rc-_thumbs2 li a:hover,ul.BSW-rc-_thumbs li a:hover{color:#ff675c;text-decoration:none}
</style>
<script type='text/javascript'>
//<![CDATA[
// Recent post home BSW
function labelthumbs(t) {
for (var e = 0; e < numposts; e++) {
var n, r = t.feed.entry[e],
m = r.title.$t;
if (e == t.feed.entry.length) break;
for (var i = 0; i < r.link.length; i++) {
if ("replies" == r.link[i].rel && "text/html" == r.link[i].type) var l = r.link[i].title,
o = r.link[i].href;
if ("alternate" == r.link[i].rel) {
n = r.link[i].href;
break
}
}
var u;
try {
u = r.media$thumbnail.url, u = u.replace("/s72-c/", "/w" + thumb_width + "-h" + thumb_height + "-c/")
} catch (h) {
s = r.content.$t, a = s.indexOf("<img"), b = s.indexOf('src="', a), c = s.indexOf('"', b + 5), d = s.substr(b + 5, c - b - 5), u = -1 != a && -1 != b && -1 != c && "" != d ? d : no_thumb
}
var p = r.published.$t,
w = p.substring(0, 4),
_ = p.substring(5, 7),
f = p.substring(8, 10),
g = new Array;
g[1] = "Tháng 1", g[2] = "Tháng 2", g[3] = "Tháng 3", g[4] = "Tháng 4", g[5] = "Tháng 5", g[6] = "Tháng 6", g[7] = "Tháng 7", g[8] = "Tháng 8", g[9] = "Tháng 9", g[10] = "Tháng 10", g[11] = "Tháng 11", g[12] = "Tháng 12", document.write('<span class="BSW-rc-_left">'), document.write('<ul class="BSW-rc-_thumbs">'), document.write("<li>"), 1 == showpostthumbnails && document.write('<a href="' + n + '"><div class="cat_thumb"><span class="rollover"></span><img width="' + thumb_width + '" height="' + thumb_height + '" alt="' + m + '" src="' + u + '"/></div></a>'), document.write('<div class="bsw-rc-in4"><span class="BSW-rc-_title"><a href="' + n + '" target ="_top">' + m + "</a></span>");
var v = "";
if (document.write('<span class="BSW-rc-_meta">'), 1 == showpostdate && (v = v + '<span class="BSW-rc-_meta_date">' + f + " " + g[parseInt(_)] + ", " + w + "</span>"), 1 == showcommentnum && ("1 Comments" == l && (l = "1 Comments"), "0 Comments" == l && (l = "0 Comments"), showcomment = '<span class="BSW-rc-_meta_comment"><a href="' + o + '">' + l + "</a></span>", v += showcomment), 1 == displaymore && (v = v + '<span class="BSW-rc-_meta_more"><a href="' + n + '" class="url" target ="_top">Read More...</a></span>'), document.write(v), document.write("</span>"), document.write('<span class="BSW-rc-_summary">'), "content" in r) var y = r.content.$t;
else if ("summary" in r) var y = r.summary.$t;
else var y = "";
var k = /<\S[^>]*>/g;
if (y = y.replace(k, ""), 1 == showpostsummary)
if (y.length < numchars) document.write(""), document.write(y), document.write("");
else {
document.write(""), y = y.substring(0, numchars);
var $ = y.lastIndexOf(" ");
y = y.substring(0, $), document.write(y + "..."), document.write("")
} document.write("</span></div>"), document.write("</li>"), document.write("</ul>"), document.write("</span>")
}
document.write('<span class="BSW-rc-_right">'), document.write('<ul class="BSW-rc-_thumbs2">');
for (var e = 1; e < numposts2; e++) {
var n, r = t.feed.entry[e],
m = r.title.$t;
if (e == t.feed.entry.length) break;
for (var i = 1; i < r.link.length; i++) {
if ("replies" == r.link[i].rel && "text/html" == r.link[i].type) var l = r.link[i].title,
o = r.link[i].href;
if ("alternate" == r.link[i].rel) {
n = r.link[i].href;
break
}
}
var x;
try {
x = r.media$thumbnail.url.replace("/s72-c/", "/w" + thumb_width2 + "-h" + thumb_height2 + "-c/")
} catch (h) {
s = r.content.$t, a = s.indexOf("<img"), b = s.indexOf('src="', a), c = s.indexOf('"', b + 5), d = s.substr(b + 5, c - b - 5), x = -1 != a && -1 != b && -1 != c && "" != d ? d : no_thumb2
}
var p = r.published.$t,
w = p.substring(0, 4),
_ = p.substring(5, 7),
f = p.substring(8, 10);
1 == showpostthumbnails2 && document.write('<li><a href="' + n + '"><div class="cat_thumb2"><img width="' + thumb_width2 + '" height="' + thumb_height2 + '" alt="' + m + '" src="' + x + '"/></div></a>'), document.write(""), document.write('<div class="bsw-inf4"><span class="BSW-rc-_title BSW-rc-_title2"><a href="' + n + '" target ="_top">' + m + "</a></span>");
var v = "";
document.write('<span class="BSW-rc-_meta BSW-rc-_meta2">'), 1 == showpostdate2 && (v = v + '<span class="BSW-rc-_meta_date">' + f + " " + g[parseInt(_)] + ", " + w + "</span>"), 1 == showcommentnum2 && ("1 Comment" == l && (l = "1 Comments"), "0 Comment" == l && (l = "0 Comments"), showcomment = '<span class="BSW-rc-_meta_comment BSW-rc-_meta_comment2"><a href="' + o + '">' + l + "</a></span>", v += showcomment), 1 == displaymore2 && (v = v + '<span class="BSW-rc-_meta_more BSW-rc-_meta_more2"><a href="' + n + '" class="url" target ="_top">Read More...</a></span>'), document.write(v), document.write("</span>"), document.write("</div></li>")
}
document.write("</ul>"), document.write("</span>")
}
//]]>
</script>
<b:if cond='data:blog.isMobileRequest == &quot;false&quot;'>
<script type='text/javascript'>
// Recent Posts home BSW Desktop
var numposts=1,numposts2=6,showpostthumbnails=!0,showpostthumbnails2=!0,displaymore=!1,displaymore2=!1,showcommentnum=!0,showcommentnum2=!0,showpostdate=!0,showpostdate2=!0,showpostsummary=!0,numchars=155,thumb_width=456,thumb_height=260,thumb_width2=285,thumb_height2=150,no_thumb=&quot;https://4.bp.blogspot.com/-jmA-qIOJIFU/WfgKSYnhm5I/AAAAAAAAABQ/ElEIBlHd31gISODb3GlA9Z_JPRKiSzvYQCLcBGAs/s600/Logo-Bac-Si-Windows.png&quot;,no_thumb2=&quot; https://4.bp.blogspot.com/-jmA-qIOJIFU/WfgKSYnhm5I/AAAAAAAAABQ/ElEIBlHd31gISODb3GlA9Z_JPRKiSzvYQCLcBGAs/s100/Logo-Bac-Si-Windows.png&quot;;
</script>
</b:if>

<b:if cond='data:blog.isMobileRequest == &quot;true&quot;'>
<script type='text/javascript'>
// Recent Posts home BSW
var numposts=1,numposts2=6,showpostthumbnails=!0,showpostthumbnails2=!0,displaymore=!1,displaymore2=!1,showcommentnum=!0,showcommentnum2=!0,showpostdate=!0,showpostdate2=!0,showpostsummary=!0,numchars=155,thumb_width=500,thumb_height=250,thumb_width2=120,thumb_height2=70,no_thumb=&quot;https://4.bp.blogspot.com/-jmA-qIOJIFU/WfgKSYnhm5I/AAAAAAAAABQ/ElEIBlHd31gISODb3GlA9Z_JPRKiSzvYQCLcBGAs/s600/Logo-Bac-Si-Windows.png&quot;,no_thumb2=&quot; https://4.bp.blogspot.com/-jmA-qIOJIFU/WfgKSYnhm5I/AAAAAAAAABQ/ElEIBlHd31gISODb3GlA9Z_JPRKiSzvYQCLcBGAs/s100/Logo-Bac-Si-Windows.png&quot;;
</script>
</b:if>

</b:if>

<b:if cond='data:view.isHomepage and !data:blog.isMobileRequest'>
<div id='home-rc2-bsw'>
<script>
document.write(&quot;&lt;script src=\&quot;/feeds/posts/default/-/Premium Theme?orderby=published&amp;alt=json-in-script&amp;callback=labelthumbs\&quot;&gt;&lt;\/script&gt;&quot;);
</script>
</div>
</b:if>

Tùy chỉnh Hiển thị bài viết theo danh mục tại trang chủ cho blogspot

  1. Premium Theme thành tên nhãn muốn hiển thị
  2. numposts=1,numposts2=6: Số bài lớn và nhỏ
  3. thumb_width=500,thumb_height=250: Độ rộng và độ cao ảnh muốn xuất ra của bài 1
  4. thumb_width2=120,thumb_height2=70: Độ rộng và độ cao ảnh muốn xuất ra của bài 2
  5. !0,!1: Ẩn
  6. 1: Hiển thị
  7. <b:if cond='data:view.isHomepage and !data:blog.isMobileRequest'> Chỉ hiện thị trên Trang chủ Desktop, mobile sẽ không hiện
- Bacsiwindows -

- - 9 bình luận
CHUYÊN MỤC
  • Comment (9)
  • Comment ()
    1. Trả lời
      1. Muốn hiện chuyên mục ở đâu của trang chủ thì mình chèn ở đó. Em chèn dưới Menu đi

        Xóa
    2. adm mới bsw mà s template lỗi thế đã vậy còn phá temp

      Trả lờiXóa
    3. A có nhận sữa tem ko, a code thêm bài viết mới vào tem này đc ko.
      Demo: tkgamemod.blogspot.com
      Và giá khoảng nhiu a?

      Trả lờiXóa