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
<?php | |
/** | |
* truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags | |
* | |
* @param string $text String to truncate. | |
* @param integer $length Length of returned string, including ellipsis. | |
* @param string $ending Ending to be appended to the trimmed string. | |
* @param boolean $exact If false, $text will not be cut mid-word | |
* @param boolean $considerHtml If true, HTML tags would be handled correctly | |
* |
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
jQuery(document).ready(function() { | |
updateItems(jQuery("#menu ul")); | |
}) | |
// listEl is the menu/list element to be read. | |
// It could be a simple string or an array | |
function updateItems(listEl = null) { | |
if (!listEl) { | |
const currentUrl = jQuery(location).attr('href'); | |
var listElArr = []; |