Skip to content

Instantly share code, notes, and snippets.

@albionselimaj
Created March 12, 2018 16:02
Show Gist options
  • Save albionselimaj/bf4fc6c03feee3e8357cf3260ebb5d98 to your computer and use it in GitHub Desktop.
Save albionselimaj/bf4fc6c03feee3e8357cf3260ebb5d98 to your computer and use it in GitHub Desktop.
Comma separated items to list view
jQuery(document).ready(function($) {
var block_class = 'block-field-therapy-offered';
var item_icon = 'mi wifi_tethering';
var content = $('.' + block_class + ' .pf-body > p').html().split(',');
if ( content && content.length ) {
$('.' + block_class + ' .pf-body').html('<ul class="details-list social-nav"></ul>');
$('.' + block_class + ' .pf-body ul').html('<li><i class="' + item_icon + '"></i> <span>' + content.join('</span></li><li><i class="' + item_icon + '"></i> <span>') + '</span></li>');
$('.grid').isotope();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment