Monday, 15 June 2015

SharePoint 2013 - Show only Top 5 Feed in Newsfeed webpart

By Default SharePoint 2013 Newsfeed webpart shows 10 posts and there is no way to customize the number of posts out of the box.

So here is the cool trick to show only 4 posts instead of 10 using Jquery - Javascript.

<script type="text/javascript">
$(document).ready(function () {
   var limit=4;
   $("#ms-feedthreadsdiv").attr("numHiddenThreads", "6")
   $("#ms-feedthreadsdiv .ms-microfeed-thread").each(function(i){

By Setting numHideenThreads attribute value = 6 for the div help you avoid overwriting the "View Posts" link functionality to load rest of the posts.
If you don't set this attribute value, then on click of "View Posts" link, it will just load rest of the posts other than original 10 posts.


No comments:

Post a Comment