Created
February 16, 2016 14:01
-
-
Save moderatorwes/5a19400f087ccd35b8a5 to your computer and use it in GitHub Desktop.
Zendesk: Limit number of promoted articles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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