Apne blog me Random post widget kaise lagaye ?

Agar aapke blog me bahut se content hai jissay aapke blog par aane wale visitors dekh nahi pate to aap random post widget ki help se randomly apne post ko display karwa sakte ho, taki apke visitors ko ek simple look mil sake ki aapne blog me or kya kya content hai. Aaj hum apne is tutorial me batayenge ki kaise aap apne blog me random post widget add kar sakte ho, to aaiye jante hai.

Apne blog me Random post widget kaise lagaye ?

Apne blog me Random post widget kaise lagaye ? How to place Random post widget with thumbnail in blogger ?

Apne blog me Random post widget kaise lagaye ?

1. Layout par click kare.
2. Add a GAdget par click kare.
3. HTML/JavaScript par click kare.

Apne blog me Random post widget kaise lagaye ?

Ab aapko niche diye gaye kisi bhi style code ko yaha paste karna hai or Save buttom par click kare.

NOTE : 

  • Kitna post display karwana chahte hai uske liye var randomposts_number = 5; 5 ko edit karke jitna post visible karwana hai utna number likhe.
  • Expert length ko kam ya jyada karne ke liye 110 value ko change kare var randomposts_chars = 110; 
  • Agar Date or commnet ko hide karne chahte hai to yes ki jagah no likhe var randomposts_details = ‘yes‘;
  • Thumbnail dimension ko change karne ke liye 75px ko edit kare.

STYLE – 1

Random post widget with thumbnail style 1

CODE :

<style> #random-posts img { border-radius: 10px;float: left;margin-right: 5px;     width: 75px;     height: 75px;     background-color: #F5F5F5;padding: 3px;transition: all 0.2s linear 0s;}#random-posts img:hover {     opacity: 0.6;}ul#random-posts {list-style-type: none;padding: 0px;}#random-posts a {font-size: 12px; text-transform: uppercase;padding: 0px auto 5px;}#random-posts a:hover {text-decoration: none;}.random-summary {font-size: 11px;background: none; padding: 5px; margin-right: 8px;}#random-posts li {margin-bottom: 10px;border-bottom: 1px solid #EEEEEE;padding: 4px;} </style> <ul id='random-posts'> <script type='text/javaScript'> var randomposts_number = 5;var randomposts_chars = 110;var randomposts_details = 'yes';var randomposts_comments = 'Comments'; var randomposts_commentsd = 'Comments Disabled'; var randomposts_current = []; var total_randomposts = 0; var randomposts_current = new Array(randomposts_number); function randomposts(json) {     total_randomposts = json.feed.openSearch$totalResults.$t } document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&max-results=0&callback=randomposts"></script>'); function getvalue() {     for (var i = 0; i < randomposts_number; i++) {         var found = false;         var rndValue = get_random();         for (var j = 0; j < randomposts_current.length; j++) {             if (randomposts_current[j] == rndValue) {                 found = true;                 break             }         };         if (found) {             i--         } else {             randomposts_current[i] = rndValue         }     } }; function get_random() {     var ranNum = 1 + Math.round(Math.random() * (total_randomposts - 1));     return ranNum }; </script> <script type='text/javaScript'> function random_posts(json) {     for (var i = 0; i < randomposts_number; i++) {         var entry = json.feed.entry[i];         var randompoststitle = entry.title.$t;         if ('content' in entry) {             var randompostsnippet = entry.content.$t         } else {             if ('summary' in entry) {                 var randompostsnippet = entry.summary.$t             } else {                 var randompostsnippet = "";             }         };         randompostsnippet = randompostsnippet.replace(/<[^>]*>/g, "");         if (randompostsnippet.length < randomposts_chars) {             var randomposts_snippet = randompostsnippet         } else {             randompostsnippet = randompostsnippet.substring(0, randomposts_chars);             var whitespace = randompostsnippet.lastIndexOf(" ");             randomposts_snippet = randompostsnippet.substring(0, whitespace) + "…";         };         for (var j = 0; j < entry.link.length; j++) {             if ('thr$total' in entry) {                 var randomposts_commentsnum = entry.thr$total.$t + ' ' + randomposts_comments             } else {                 randomposts_commentsnum = randomposts_commentsd             }; if (entry.link[j].rel == 'alternate') {                 var randompostsurl = entry.link[j].href;                 var randomposts_date = entry.published.$t;                 if ('media$thumbnail' in entry) {                     var randompoststhumb = entry.media$thumbnail.url                 } else {                     randompoststhumb = "http://3.bp.blogspot.com/-5SoVe1K6JSk/Utl0OOmucAI/AAAAAAAAF6E/hQghgD_EJdQ/s1600/no_thumb.png"                 }             }         };         document.write('<li>');         document.write('<a href="' + randompostsurl + '" rel="nofollow"><img alt="' + randompoststitle + '" src="' + randompoststhumb + '"/></a>');         document.write('<div><a href="' + randompostsurl + '" rel="nofollow">' + randompoststitle + '</a></div>');         if (randomposts_details == 'yes') {             document.write('<span><div  class="random-info">' + randomposts_date.substring(8, 10) + '.' + randomposts_date.substring(5, 7) + '.' + randomposts_date.substring(0, 4) + ' - ' + randomposts_commentsnum) + '</div></span>'         };         document.write('<br/><div class="random-summary">' + randomposts_snippet + '</div><div style="clear:both"></div></li>')     } }; getvalue(); for (var i = 0; i < randomposts_number; i++) {document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&start-index=' + randomposts_current[i] + '&max-results=1&callback=random_posts"></script>')};</script></ul><div class="sitemap-link"></div>

STYLE- 2

Random post widget with thumbnail style 2

CODE :

<style> #random-posts img { border-radius: 10px;float: left;margin-right: 5px;     width: 75px;     height: 75px;     background-color: #F5F5F5;padding: 3px;transition: all 0.2s linear 0s;}#random-posts img:hover {     opacity: 0.6;}ul#random-posts {list-style-type: none;padding: 0px;}  #random-posts a {font-size: 12px; text-transform: uppercase;padding: 0px auto 5px;color: brown;}  #random-posts a:hover {text-decoration: none;}  .random-summary {font-size: 11px;background: none; padding: 5px; margin-right: 8px;color: blue;}  #random-posts li {margin-bottom: 10px;border: 1px solid black;padding: 4px;} </style> <ul id='random-posts'> <script type='text/javaScript'> var randomposts_number = 5; var randomposts_chars = 110; var randomposts_details = 'yes'; var randomposts_comments = 'Comments'; var randomposts_commentsd = 'Comments Disabled'; var randomposts_current = []; var total_randomposts = 0; var randomposts_current = new Array(randomposts_number); function randomposts(json) {     total_randomposts = json.feed.openSearch$totalResults.$t } document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&max-results=0&callback=randomposts"></script>'); function getvalue() {     for (var i = 0; i < randomposts_number; i++) {         var found = false;         var rndValue = get_random();         for (var j = 0; j < randomposts_current.length; j++) {             if (randomposts_current[j] == rndValue) {                 found = true;                 break             }         };         if (found) {             i--         } else {             randomposts_current[i] = rndValue         }     } }; function get_random() {     var ranNum = 1 + Math.round(Math.random() * (total_randomposts - 1));     return ranNum }; </script> <script type='text/javaScript'> function random_posts(json) {     for (var i = 0; i < randomposts_number; i++) {         var entry = json.feed.entry[i];         var randompoststitle = entry.title.$t;         if ('content' in entry) {             var randompostsnippet = entry.content.$t         } else {             if ('summary' in entry) {                 var randompostsnippet = entry.summary.$t             } else {                 var randompostsnippet = "";             }         };         randompostsnippet = randompostsnippet.replace(/<[^>]*>/g, "");         if (randompostsnippet.length < randomposts_chars) {             var randomposts_snippet = randompostsnippet         } else {             randompostsnippet = randompostsnippet.substring(0, randomposts_chars);             var whitespace = randompostsnippet.lastIndexOf(" ");             randomposts_snippet = randompostsnippet.substring(0, whitespace) + "…";         };         for (var j = 0; j < entry.link.length; j++) {             if ('thr$total' in entry) {                 var randomposts_commentsnum = entry.thr$total.$t + ' ' + randomposts_comments             } else {                 randomposts_commentsnum = randomposts_commentsd             }; if (entry.link[j].rel == 'alternate') {                 var randompostsurl = entry.link[j].href;                 var randomposts_date = entry.published.$t;                 if ('media$thumbnail' in entry) {                     var randompoststhumb = entry.media$thumbnail.url                 } else {                     randompoststhumb = "http://3.bp.blogspot.com/-5SoVe1K6JSk/Utl0OOmucAI/AAAAAAAAF6E/hQghgD_EJdQ/s1600/no_thumb.png"                 }             }         };         document.write('<li>');         document.write('<a href="' + randompostsurl + '" rel="nofollow"><img alt="' + randompoststitle + '" src="' + randompoststhumb + '"/></a>');         document.write('<div><a href="' + randompostsurl + '" rel="nofollow">' + randompoststitle + '</a></div>');         if (randomposts_details == 'yes') {             document.write('<span><div  class="random-info">' + randomposts_date.substring(8, 10) + '.' + randomposts_date.substring(5, 7) + '.' + randomposts_date.substring(0, 4) + ' - ' + randomposts_commentsnum) + '</div></span>'         };         document.write('<br/><div class="random-summary">' + randomposts_snippet + '</div><div style="clear:both"></div></li>')     } }; getvalue(); for (var i = 0; i < randomposts_number; i++) {document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&start-index=' + randomposts_current[i] + '&max-results=1&callback=random_posts"></script>')};</script></ul><div class="sitemap-link"></div>

STYLE – 3

Random post widget with thumbnail style 3

CODE :

<style>#random-posts img { float: right;margin-right: 5px;     width: 75px;     height: 75px;     background-color: brown;padding: 1px;transition: all 0.2s linear 0s;} #random-posts img:hover {ackground-color: red;padding: 2px;} ul#random-posts {list-style-type: none;padding: 0px;} #random-posts a {font-size: 12px; text-transform: uppercase;padding: 0px auto 5px;color: brown;} #random-posts a:hover {text-decoration: none;} .random-summary {font-size: 11px;background: none; padding: 5px; margin-right: 8px;color: blue;} #random-posts li {margin-bottom: 10px;border: 1px solid black;padding: 4px;background-color: #b4b6b766;    box-shadow: -2px 1px 5px 1px;} #random-posts li:hover{border:3px;} </style> <ul id='random-posts'> <script type='text/javaScript'> var randomposts_number = 5; var randomposts_chars = 110; var randomposts_details = 'yes'; var randomposts_comments = 'Comments'; var randomposts_commentsd = 'Comments Disabled'; var randomposts_current = []; var total_randomposts = 0; var randomposts_current = new Array(randomposts_number); function randomposts(json) {     total_randomposts = json.feed.openSearch$totalResults.$t } document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&max-results=0&callback=randomposts"></script>'); function getvalue() {     for (var i = 0; i < randomposts_number; i++) {         var found = false;         var rndValue = get_random();         for (var j = 0; j < randomposts_current.length; j++) {             if (randomposts_current[j] == rndValue) {                 found = true;                 break             }         };         if (found) {             i--         } else {             randomposts_current[i] = rndValue         }     } }; function get_random() {     var ranNum = 1 + Math.round(Math.random() * (total_randomposts - 1));     return ranNum }; </script> <script type='text/javaScript'> function random_posts(json) {     for (var i = 0; i < randomposts_number; i++) {         var entry = json.feed.entry[i];         var randompoststitle = entry.title.$t;         if ('content' in entry) {             var randompostsnippet = entry.content.$t         } else {             if ('summary' in entry) {                 var randompostsnippet = entry.summary.$t             } else {                 var randompostsnippet = "";             }         };         randompostsnippet = randompostsnippet.replace(/<[^>]*>/g, "");         if (randompostsnippet.length < randomposts_chars) {             var randomposts_snippet = randompostsnippet         } else {             randompostsnippet = randompostsnippet.substring(0, randomposts_chars);             var whitespace = randompostsnippet.lastIndexOf(" ");             randomposts_snippet = randompostsnippet.substring(0, whitespace) + "…";         };         for (var j = 0; j < entry.link.length; j++) {             if ('thr$total' in entry) {                 var randomposts_commentsnum = entry.thr$total.$t + ' ' + randomposts_comments             } else {                 randomposts_commentsnum = randomposts_commentsd             }; if (entry.link[j].rel == 'alternate') {                 var randompostsurl = entry.link[j].href;                 var randomposts_date = entry.published.$t;                 if ('media$thumbnail' in entry) {                     var randompoststhumb = entry.media$thumbnail.url                 } else {                     randompoststhumb = "http://3.bp.blogspot.com/-5SoVe1K6JSk/Utl0OOmucAI/AAAAAAAAF6E/hQghgD_EJdQ/s1600/no_thumb.png"                 }             }         };         document.write('<li>');         document.write('<a href="' + randompostsurl + '" rel="nofollow"><img alt="' + randompoststitle + '" src="' + randompoststhumb + '"/></a>');         document.write('<div><a href="' + randompostsurl + '" rel="nofollow">' + randompoststitle + '</a></div>');         if (randomposts_details == 'yes') {             document.write('<span><div  class="random-info">' + randomposts_date.substring(8, 10) + '.' + randomposts_date.substring(5, 7) + '.' + randomposts_date.substring(0, 4) + ' - ' + randomposts_commentsnum) + '</div></span>'         };         document.write('<br/><div class="random-summary">' + randomposts_snippet + '</div><div style="clear:both"></div></li>')     } }; getvalue(); for (var i = 0; i < randomposts_number; i++) {document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&start-index=' + randomposts_current[i] + '&max-results=1&callback=random_posts"></script>')};</script></ul><div class="sitemap-link"></div>

STYLE – 4

Random post widget with thumbnail style 4

CODE :

<style>#random-posts img { float: left;border-radius: 37px;box-shadow: 0px 0px 14px 0px;margin-right: 5px;     width: 75px;     height: 75px;     background-color: brown;padding: 1px;transition: all 0.2s linear 0s;} #random-posts img:hover {ackground-color: red;padding: 2px;} ul#random-posts {list-style-type: none;padding: 0px;} #random-posts a {font-size: 12px; text-transform: uppercase;padding: 0px auto 5px;color: brown;} #random-posts a:hover {text-decoration: none;} .random-summary {font-size: 11px;background: none; padding: 5px; margin-right: 8px;color: blue;} #random-posts li {margin-bottom: 10px;border: 1px solid black;padding: 4px;background-color: #b4b6b766;    box-shadow: -2px 1px 5px 1px;} #random-posts li:hover{border:3px;} </style> <ul id='random-posts'> <script type='text/javaScript'> var randomposts_number = 5; var randomposts_chars = 110; var randomposts_details = 'yes'; var randomposts_comments = 'Comments'; var randomposts_commentsd = 'Comments Disabled'; var randomposts_current = []; var total_randomposts = 0; var randomposts_current = new Array(randomposts_number); function randomposts(json) {     total_randomposts = json.feed.openSearch$totalResults.$t } document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&max-results=0&callback=randomposts"></script>'); function getvalue() {     for (var i = 0; i < randomposts_number; i++) {         var found = false;         var rndValue = get_random();         for (var j = 0; j < randomposts_current.length; j++) {             if (randomposts_current[j] == rndValue) {                 found = true;                 break             }         };         if (found) {             i--         } else {             randomposts_current[i] = rndValue         }     } }; function get_random() {     var ranNum = 1 + Math.round(Math.random() * (total_randomposts - 1));     return ranNum }; </script> <script type='text/javaScript'> function random_posts(json) {     for (var i = 0; i < randomposts_number; i++) {         var entry = json.feed.entry[i];         var randompoststitle = entry.title.$t;         if ('content' in entry) {             var randompostsnippet = entry.content.$t         } else {             if ('summary' in entry) {                 var randompostsnippet = entry.summary.$t             } else {                 var randompostsnippet = "";             }         };         randompostsnippet = randompostsnippet.replace(/<[^>]*>/g, "");         if (randompostsnippet.length < randomposts_chars) {             var randomposts_snippet = randompostsnippet         } else {             randompostsnippet = randompostsnippet.substring(0, randomposts_chars);             var whitespace = randompostsnippet.lastIndexOf(" ");             randomposts_snippet = randompostsnippet.substring(0, whitespace) + "…";         };         for (var j = 0; j < entry.link.length; j++) {             if ('thr$total' in entry) {                 var randomposts_commentsnum = entry.thr$total.$t + ' ' + randomposts_comments             } else {                 randomposts_commentsnum = randomposts_commentsd             }; if (entry.link[j].rel == 'alternate') {                 var randompostsurl = entry.link[j].href;                 var randomposts_date = entry.published.$t;                 if ('media$thumbnail' in entry) {                     var randompoststhumb = entry.media$thumbnail.url                 } else {                     randompoststhumb = "http://3.bp.blogspot.com/-5SoVe1K6JSk/Utl0OOmucAI/AAAAAAAAF6E/hQghgD_EJdQ/s1600/no_thumb.png"                 }             }         };         document.write('<li>');         document.write('<a href="' + randompostsurl + '" rel="nofollow"><img alt="' + randompoststitle + '" src="' + randompoststhumb + '"/></a>');         document.write('<div><a href="' + randompostsurl + '" rel="nofollow">' + randompoststitle + '</a></div>');         if (randomposts_details == 'yes') {             document.write('<span><div  class="random-info">' + randomposts_date.substring(8, 10) + '.' + randomposts_date.substring(5, 7) + '.' + randomposts_date.substring(0, 4) + ' - ' + randomposts_commentsnum) + '</div></span>'         };         document.write('<br/><div class="random-summary">' + randomposts_snippet + '</div><div style="clear:both"></div></li>')     } }; getvalue(); for (var i = 0; i < randomposts_number; i++) {document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&start-index=' + randomposts_current[i] + '&max-results=1&callback=random_posts"></script>')};</script></ul><div class="sitemap-link"></div>

STYLE – 5

Random post widget with thumbnail style 5

CODE :

<style>#random-posts img { float: left;border-top-left-radius: 10px;box-shadow: 0px 0px 14px 0px;margin-right: 5px;     width: 75px;     height: 75px;     background-color: brown;padding: 1px;transition: all 0.2s linear 0s;} #random-posts img:hover {ackground-color: red;padding: 2px;} ul#random-posts {list-style-type: none;padding: 0px;} #random-posts a {font-size: 12px; text-transform: uppercase;padding: 0px auto 5px;color: black;} #random-posts a:hover {color: red;} .random-summary {font-size: 11px;background: none; padding: 5px; margin-right: 8px;color: blue;} #random-posts li {margin-bottom: 10px;     border: 1px solid black;     padding: 6px;     background-color: #f8fb82;     box-shadow: inset 1px 0px 19px 2px;     border-radius: 8px;} #random-posts li:hover{background-color: white;} </style> <ul id='random-posts'> <script type='text/javaScript'> var randomposts_number = 5; var randomposts_chars = 110; var randomposts_details = 'yes'; var randomposts_comments = 'Comments'; var randomposts_commentsd = 'Comments Disabled'; var randomposts_current = []; var total_randomposts = 0; var randomposts_current = new Array(randomposts_number); function randomposts(json) {     total_randomposts = json.feed.openSearch$totalResults.$t } document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&max-results=0&callback=randomposts"></script>'); function getvalue() {     for (var i = 0; i < randomposts_number; i++) {         var found = false;         var rndValue = get_random();         for (var j = 0; j < randomposts_current.length; j++) {             if (randomposts_current[j] == rndValue) {                 found = true;                 break             }         };         if (found) {             i--         } else {             randomposts_current[i] = rndValue         }     } }; function get_random() {     var ranNum = 1 + Math.round(Math.random() * (total_randomposts - 1));     return ranNum }; </script> <script type='text/javaScript'> function random_posts(json) {     for (var i = 0; i < randomposts_number; i++) {         var entry = json.feed.entry[i];         var randompoststitle = entry.title.$t;         if ('content' in entry) {             var randompostsnippet = entry.content.$t         } else {             if ('summary' in entry) {                 var randompostsnippet = entry.summary.$t             } else {                 var randompostsnippet = "";             }         };         randompostsnippet = randompostsnippet.replace(/<[^>]*>/g, "");         if (randompostsnippet.length < randomposts_chars) {             var randomposts_snippet = randompostsnippet         } else {             randompostsnippet = randompostsnippet.substring(0, randomposts_chars);             var whitespace = randompostsnippet.lastIndexOf(" ");             randomposts_snippet = randompostsnippet.substring(0, whitespace) + "…";         };         for (var j = 0; j < entry.link.length; j++) {             if ('thr$total' in entry) {                 var randomposts_commentsnum = entry.thr$total.$t + ' ' + randomposts_comments             } else {                 randomposts_commentsnum = randomposts_commentsd             }; if (entry.link[j].rel == 'alternate') {                 var randompostsurl = entry.link[j].href;                 var randomposts_date = entry.published.$t;                 if ('media$thumbnail' in entry) {                     var randompoststhumb = entry.media$thumbnail.url                 } else {                     randompoststhumb = "http://3.bp.blogspot.com/-5SoVe1K6JSk/Utl0OOmucAI/AAAAAAAAF6E/hQghgD_EJdQ/s1600/no_thumb.png"                 }             }         };         document.write('<li>');         document.write('<a href="' + randompostsurl + '" rel="nofollow"><img alt="' + randompoststitle + '" src="' + randompoststhumb + '"/></a>');         document.write('<div><a href="' + randompostsurl + '" rel="nofollow">' + randompoststitle + '</a></div>');         if (randomposts_details == 'yes') {             document.write('<span><div  class="random-info">' + randomposts_date.substring(8, 10) + '.' + randomposts_date.substring(5, 7) + '.' + randomposts_date.substring(0, 4) + ' - ' + randomposts_commentsnum) + '</div></span>'         };         document.write('<br/><div class="random-summary">' + randomposts_snippet + '</div><div style="clear:both"></div></li>')     } }; getvalue(); for (var i = 0; i < randomposts_number; i++) {document.write('<script type="text/javascript" src="/feeds/posts/default?alt=json-in-script&start-index=' + randomposts_current[i] + '&max-results=1&callback=random_posts"></script>')};</script></ul><div class="sitemap-link"></div>

Agar aapko Random post widget lagane me koi problem aa rahi hai to aap hume comment ke jariye jarur bataye. HAPPY BLOGGING

2 Replies to “Apne blog me Random post widget kaise lagaye ?”

  1. सर, आपके इस HTML CODE में कोई ERROR है क्योंकि ये काम नही कर रहा है। मैंने इसे अपने BLOG में लगाने की बहुत कोशिश की लेकिन ये काम नही किया।

    1. Sahi kaha aapne, code me error hone ki wajah se ye thik se kaam nahi kar raha tha.. Aap ek bar fir se try kare ye work kar raha hai..

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.