Loading...

How To Add Breaking News Feed On The Blog

Breaking News is a wigdet which has the function to display some news or posts on your blog in a row and appears alternately. Usually Breaking News, will display the newest posts from your blog. With this widget, your blog will look more responsive and professional. Therefore, infoBlog will share an articles about How To Add Breaking News Feed On The Blog.


How To Add Breaking News Feed :

  1. Go to your Blogger Dashboard ›› Template ›› Edit HTML.
  2. Add the code below before ]]></b:skin> or </style>.
  3. /* CSS Breaking News by infoBlog*/
    #breakingnews {margin:15px 0 0 0;margin-right:15px;height:42px;line-height:29px;overflow:hidden;background:#fff;border:1px solid #e6e6e6;}
    #breakingnews .breakhead {position:absolute;background:none repeat scroll 0 0 #363b40;color:#fff;display:block;float:left;font-family:inherit;font-size:16px;font-weight:400;text-transform:uppercase;padding:6.5px 22px;}
    #adbreakingnews li a {font-family:inherit;font-weight:400;color:#666;margin-top:10px;transition:all 0.5s ease-in-out;}
    #adbreakingnews li a:hover {color:#359bed;}
    #adbreakingnews {float:left;margin-left:75px;margin-top:6px;}
    #adbreakingnews ul,#adbreakingnews li{list-style:none;margin:0;padding:0}

    @media only screen and (max-width:640px){

    #breakingnews {margin:20px 0 0 0;margin-right:0;}
    #breakingnews .breakhead {padding:6.5px 14px;}
    #adbreakingnews {margin-left:50px;}}
  4. Then add the code below before </body>.
  5. <script type='text/javascript'>
    //<![CDATA[
    // Breaking News
    $(document).ready(function(){var e="Your URL Blog",t=20;$.ajax({url:""+e+"/feeds/posts/default?alt=json-in-script&max-results="+t,type:"get",dataType:"jsonp",success:function(e){function t(){$("#adbreakingnews li:first").slideUp(function(){$(this).appendTo($("#adbreakingnews ul")).slideDown()})}var n,r,s="",a=e.feed.entry;if(void 0!==a){s="<ul>";for(var l=0;l<a.length;l++){for(var o=0;o<a[l].link.length;o++)if("alternate"==a[l].link[o].rel){n=a[l].link[o].href;break}r=a[l].title.$t,s+='<li><a href="'+n+'" target="_blank">'+r+"</a></li>"}s+="</ul>",$("#adbreakingnews").html(s),setInterval(function(){t()},5e3)}else $("#adbreakingnews").html("<span>No result!</span>")},error:function(){$("#adbreakingnews").html("<strong>Error Loading Feed!</strong>")}})});
    //]]>
    </script>
  6. After that, to display Breaking News on your blog, add the code below between <body> and </body>.
  7. <div id='breakingnews'><span class='breakhead'><i class='fa fa-rss'/></span>
    <div id='adbreakingnews'>Loading...</div></div>
  8. Done. See the result on your blog.
For Result :


Enough of articles about How To Add Breaking News Feed On The Blog. If you have any questions or suggestions, please write in the comments field below or directly send questions through the Contact Us service. Hopefully this article useful and you willing to share this article through social media accounts you have.


Thanks For Your Visiting


EmoticonEmoticon