function the_truncated_post($symbol_amount) {
$filtered = strip_tags( preg_replace('@<style[^>]*?>.*?</style>@si', '', preg_replace('@<script[^>]*?>.*?</script>@si', '', apply_filters('the_content', get_the_content()))) );
echo substr($filtered, 0, strrpos(substr($filtered, 0, $symbol_amount), ' ')) . '...';
}
the_truncated_post( 100 );
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('.js-anchor').on('click', function(e) {
e.preventDefault();
var
href = $(this).attr('href'),
timeout = 5000;
setTimeout(function() {
//window.open(href, '_self');
location.href = href;
}, timeout);
});
});
</script>
</head>
<body>
<a class="js-anchor" href="http://yandex.ru">click me</a>
</body>
</html>