--> Skip to main content

How to Make Widget Recent Post

How to Set Recent Post Widget in Our Blog

Please copy and save this code below in our widget blog, on HTML/JavaScript

 <ul id="recent-posts"></ul>
var homePage = "http://learningbasedweb.blogspot.com/",
numPosts = 3;
function recentPosts(a){if(document.getElementById("recent-posts")){var e=a.feed.entry,title,link,content="",ct=document.getElementById("recent-posts");for(var i=0;i<numPosts;i++){for(var j=0;j<numPosts;j++){if(e[i].link[j].rel=="alternate"){link=e[i].link[j].href;break}}var title=e[i].title.$t;content+='<li class="recent-posts"><strong><a href="'+link+'" title="'+title+'" target="_blank">'+title+'</a></strong></li>'}ct.innerHTML=content}}var rcp=document.createElement('script');rcp.src=homePage+'/feeds/posts/summary?alt=json-in-script&orderby=published&max-results='+numPosts+'&callback=recentPosts';document.getElementsByTagName('head')[0].appendChild(rcp);

How to Arrange It
Below are the ways to set the element of this widget in the blog. There is two things that you should do here. First, you must understand what is the Icon varhomePage; It tells your website URL. You can fill it in this form. Second, you must understand about what is Icon nuPosts; it tells us about how many articles which the blogger will set in the blog's widget.

var homePage
Fill with your blog URL
Fill with the total of our Articles which will be displayed

To set up the total of your articles that will be displayed on the widgets, see the sentences that i give the mark. You must look at the sentences with the blue background. In here, you must change by your website condition.

Ok That's all of my explanation about how to create recent post widget. If any questions please contact me by giving comment below. Thanks
Comment Policy: Silahkan tuliskan komentar Anda yang sesuai dengan topik postingan halaman ini. Komentar yang berisi tautan tidak akan ditampilkan sebelum disetujui.
Buka Komentar
Tutup Komentar