Created
May 19, 2015 00:42
-
-
Save moderatorwes/c19ef987d5be6d337b24 to your computer and use it in GitHub Desktop.
Zendesk: Limit the number of Promoted Articles
This file contains 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
//Only show five promoted articles | |
$(document).ready(function () { | |
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