How to Make Widget Recent Post

Baca Juga

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 = "",
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

0 Response to "How to Make Widget Recent Post"

Post a Comment

Peraturan Dalam Berkomentar:
1. Komentar harus relevan dengan konten blog
2. Harus menggunakan bahasa yang sopan
3. Tidak boleh menyinggung SARA or Bullying.
4. Hindari komentar SPAM. Exp: Nice gan, Makasih Gan, dll
5. Tidak ada link di dalam isi komentar. Aktif maupun tidak.

Gunakanlah Sarana Publik ini dengan Bijak. Baca dan Pahami isinya baru Berkomentar. Terimakasih.