Skip to content

Instantly share code, notes, and snippets.

@moderatorwes
Created February 16, 2016 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moderatorwes/5a19400f087ccd35b8a5 to your computer and use it in GitHub Desktop.
Save moderatorwes/5a19400f087ccd35b8a5 to your computer and use it in GitHub Desktop.
Zendesk: Limit number of promoted articles
//Limit number of promoted articles on homepage
if(typeof $('.promoted-articles ul').get(0) != 'undefined') {
var _sectionArticles = $('.promoted-articles ul');
_sectionArticles.each(function(_aidx, _aitm) {
var _itmCount = $(_aitm).find('li').length;
var _allLink = $(_aitm).prev('h3').find('a').attr('href');
if(_itmCount > 5) {
for(var x = (_itmCount - 1); x > 4; x--) {
$($(_aitm).find('li')[x]).remove();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment