
{"id":4099,"date":"2014-11-30T01:50:31","date_gmt":"2014-11-30T01:50:31","guid":{"rendered":"http:\/\/tapchicntt.com\/?p=4099"},"modified":"2023-08-07T08:18:38","modified_gmt":"2023-08-07T01:18:38","slug":"cach-tao-widget-bai-moi-nhat-hien-thi-theo-label-co-thumbnails-anh","status":"publish","type":"post","link":"https:\/\/tapchicntt.com\/cach-tao-widget-bai-moi-nhat-hien-thi-theo-label-co-thumbnails-anh\/","title":{"rendered":"C\u00e1ch t\u1ea1o Widget b\u00e0i m\u1edbi nh\u1ea5t hi\u1ec3n th\u1ecb theo Label c\u00f3 Thumbnails \u1ea3nh"},"content":{"rendered":"\n<p>Ch\u00e0o c\u00e1c b\u1ea1n h\u00f4m nay ch\u00fang t\u00f4i xin h\u01b0\u1edbng d\u1eabn c\u00e1ch t\u1ea1o Widget hi\u1ec3n th\u1ecb b\u00e0i vi\u1ebft m\u1edbi theo Label v\u00e0 c\u00f3 Thumbnails \u1ea3nh cho blogger. M\u1ee5c \u0111\u00edch vi\u1ec7c n\u00e0y gi\u00fap blog c\u1ee7a b\u1ea1n sinh \u0111\u1ed9ng h\u01a1n v\u00e0 khi\u1ebfn ng\u01b0\u1eddi \u0111\u1ecdc d\u1ec5 theo d\u00f5i v\u00e0 c\u00f3 th\u1ec3 \u0111\u1ecdc nhi\u1ec1u b\u00e0i vi\u1ebft h\u01a1n.<br><\/p>\n\n\n\n<!--more-->\n\n\n\n<p><br>\u0110\u1ec3 l\u00e0m c\u00e1i n\u00e0y ,b\u1ea1n c\u1ea7n th\u1ef1c hi\u1ec7n theo b\u01b0\u1edbc sau.<\/p>\n\n\n\n<p>B\u01b0\u1edbc 01: Login blogspot <strong>&gt; Template (M\u1eabu) &gt; Edite HTML (Ch\u1ec9nh s\u1eeda HTML)<\/strong>.<\/p>\n\n\n\n<p>&#8211; Ch\u00fa \u00fd: tr\u01b0\u1edbc khi edit n\u00ean backup code g\u1ed1c tr\u00e1nh khi s\u1eeda sai kh\u00f4ng kh\u00f4i ph\u1ee5c l\u1ea1i \u0111\u01b0\u1ee3c nh\u00e9.<\/p>\n\n\n\n<p>B\u01b0\u1edbc 02: Th\u00eam code d\u01b0\u1edbi l\u00ean tr\u01b0\u1edbc \u0111o\u1ea1n code <strong><code>]]>&lt;\/b:skin><\/code><\/strong> (d\u00f9ng ctrl F \u0111\u1ec3 t\u00ecm nh\u00e9)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n\/* Recent posts by labels *\/\nimg.label_thumb{\n float:left;margin-right:10px !important;\n height:65px; \/* Thumbnail height *\/\n width:65px; \/* Thumbnail width *\/\n border: 1px solid #fff;\n -webkit-border-radius: 10px;\n -moz-border-radius: 10px;\n border-radius: 10px;\n -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .4);\n -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .4);\n box-shadow: 0 1px 1px rgba(0, 0, 0, .4);\n}\n#label_with_thumbs {\n float: left;\n width: 100%;\n min-height: 70px;\n margin: 0px 10px 2px 0px;\n padding: 0;\n}\nul#label_with_thumbs li {\n padding:8px 0;\n min-height:65px;\n margin-bottom:0px;\n border-bottom: 1px dotted #999999;\n}\n#label_with_thumbs li{\n list-style: none ;\n padding-left:0px !important;}\n#label_with_thumbs a {text-transform: uppercase;}\n#label_with_thumbs strong {padding-left:0px;}\n<\/pre><\/div>\n\n\n<p>B\u01b0\u1edbc 3: Copy \u0111o\u1ea1n code d\u01b0\u1edbi tr\u01b0\u1edbc th\u1ebb \u0111\u00f3ng &lt;\/head><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;strong&gt;&lt;br&gt;&#039;);\nif(\u201ccontent\u201din entry){\n    var postcontent=entry.content.$t;\n} elseif (\u201csummary\u201din entry){\n    var postcontent=entry.summary.$t;\n} else var postcontent=\u201d\u201d;\nvar re=\/&lt;\\S&#x5B;^&gt;]*&gt;\/g;\npostcontent=postcontent.replace(re,\u201d\u201d);\nif(showpostsummary==true){\n    if(postcontent.length&lt;numchars){\n        document.write(\u201d);\n        document.write(postcontent);\n        document.write(\u201d);\n    } else{ \n        document.write(\u201d);\n        postcontent=postcontent.substring(0,numchars);\n        var quoteEnd=postcontent.lastIndexOf(\u201d \u201c);\n        postcontent=postcontent.substring(0,quoteEnd);\n        document.write(postcontent+&#039;\u2026&#039;);\n        document.write(\u201d);\n    }\n} \nvar towrite=&#039;&#039;;\nvar flag=0;\ndocument.write(&#039;&lt;br&gt;&#039;);\n\nif(showpostdate==true){\n    towrite=towrite+monthnames&#x5B;parseInt(cdmonth,10)]+&#039;-&#039;+cdday+&#039; - &#039;+cdyear;\n    flag=1;\n}\nif(showcommentnum==true){\n    if(flag==1){\n        towrite=towrite+&#039; | &#039;;\n    }\n    if(commenttext==&#039;1 Comments&#039;)commenttext=&#039;1 Comment&#039;;\n    if(commenttext==&#039;0 Comments&#039;)commenttext=&#039;No Comments&#039;;\n    commenttext=&#039;&lt;a href=\u201d&#039;+commenturl+&#039;\u201d target =\u201d_top\u201d&gt;&#039;+commenttext+&#039;&lt;a&gt;&#039;;\n    towrite=towrite+commenttext;flag=1;;\n}\nif(displaymore==true){\n    if(flag==1)towrite=towrite+&#039; | &#039;;\n    towrite=towrite+&#039;&lt;a href=\u201d&#039;+posturl+&#039;\u201d class=\u201durl\u201d target =\u201d_top\u201d&gt;More \u00bb&lt;a&gt;&#039;;\n    flag=1;;\n}\ndocument.write(towrite);\ndocument.write(&#039;&lt;li&gt;&#039;);\n    if(displayseparator==true)if(i!=(numposts-1))document.write(\u201d);\n}\ndocument.write(&#039;&lt;ul&gt;&#039;);\n}\/\/]]&gt;&lt;script&gt;\n<\/pre><\/div>\n\n\n<p>B\u01b0\u1edbc 4: Th\u00eam code d\u01b0\u1edbi \u1edf tr\u01b0\u1edbc th\u1ebb &lt;\/body&gt;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n&lt;script type=&#039;text\/javascript&#039;&gt;\nfunction changeThumbSize(id,size) {\n    var blogGadget = document.getElementById(id);\n    var replacement = blogGadget.innerHTML;\n    blogGadget.innerHTML = replacement.replace(\/s72-c\/g,\u201ds\u201d+size+\u201d-c\u201d);\n    var thumbnails = blogGadget.getElementsByTagName(\u201cimg\u201d);\n    for(var i=0; i &lt; thumbnails.length;i++){\n        thumbnails&#x5B;i].width = size;\n        thumbnails&#x5B;i].height = size;\n    }\n}\n changeThumbSize(\u201clabel_with_thumbs\u201d,210);\n&lt;\/script&gt;\n<\/pre><\/div>\n\n\n<p>Sau \u0111\u00f3 b\u1ea1n save template l\u1ea1i<\/p>\n\n\n\n<p>B\u01b0\u1edbc 5: b\u1ea1n t\u1ea1o 01 widget m\u1edbi \u0111\u1eb7t t\u00ean t\u00f9y \u00fd. V\u00e0 copy code d\u01b0\u1edbi \u0111\u00e2y v\u00e0o \u0111\u1ec3 k\u00edch ho\u1ea1t:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n&lt;script type=&quot;text\/javascript&quot;&gt;\n    var numposts = 3;\n    var showpostthumbnails = true;\n    var displaymore = false;\n    var displayseparator = true;\n    var showcommentnum = false;\n    var showpostdate = false;\n    var showpostsummary = true;\n    var numchars = 100;\n&lt;\/script&gt;\n&lt;script type=&quot;text\/javascript&quot; src=&quot;\/feeds\/posts\/default\/-\/Ten-label-ban-can-hien-thi?published&amp;amp;alt=json-in-script&amp;amp;callback=labelthumbs&quot;&gt;&lt;\/script&gt;\n<\/pre><\/div>\n\n\n<p>Tinh ch\u1ec9nh theo \u00fd th\u00edch :<br>&#8211; var numposts \u2190 L\u00e0 s\u1ed1 b\u00e0i vi\u1ebft mu\u1ed1n hi\u1ec3n th\u1ecb<br>&#8211; var showpostthumbnails \u2190 Hi\u1ec3n th\u1ecb ho\u1eb7c kh\u00f4ng hi\u1ec3n th\u1ecb \u1ea3nh (true ngh\u0129a l\u00e0 c\u00f3 hi\u1ec3n th\u1ecb)<br>&#8211; var displaymore \u2190 C\u00f3 hi\u1ec3n th\u1ecb read more link kh\u00f4ng<br>&#8211; var displayseparator \u2190 Hi\u1ec7n th\u1ecb ng\u0103n c\u00e1ch b\u00e0i<br>&#8211; var showcommentnum \u2190 Hi\u1ec3n th\u1ecb s\u1ed1 l\u01b0\u1ee3ng comment<br>&#8211; var showpostdate \u2190 Hi\u1ec3n th\u1ecb ng\u00e0y post b\u00e0i<br>&#8211; var showpostsummary \u2190 Hi\u1ec3n th\u1ecb hay kh\u00f4gn t\u1ed5ng s\u1ed1 b\u00e0i<br>&#8211; var numchars \u2190 Hi\u1ec3n th\u1ecb s\u1ed1 l\u01b0\u1ee3ng ch\u1eef ( bthg l\u00e0 100 ch\u1eef c\u00e1i)<\/p>\n\n\n\n<p>Cu\u1ed1i c\u00f9ng l\u00e0 b\u1ea1n ra xem blog b\u1ea1n hi\u1ec3n th\u1ecb \u0111\u00e3 v\u1eeba \u00fd ch\u01b0a. Ch\u00fac c\u00e1c b\u1ea1n th\u00e0nh c\u00f4ng!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ch\u00e0o c\u00e1c b\u1ea1n h\u00f4m nay ch\u00fang t\u00f4i xin h\u01b0\u1edbng d\u1eabn c\u00e1ch t\u1ea1o Widget hi\u1ec3n th\u1ecb b\u00e0i vi\u1ebft m\u1edbi theo Label [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":7942,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[170],"tags":[],"class_list":["post-4099","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogger"],"views":523,"_links":{"self":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts\/4099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/comments?post=4099"}],"version-history":[{"count":14,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts\/4099\/revisions"}],"predecessor-version":[{"id":8008,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts\/4099\/revisions\/8008"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/media\/7942"}],"wp:attachment":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/media?parent=4099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/categories?post=4099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/tags?post=4099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}