yan-k
8/19/2016 - 8:07 AM

Enfold Theme Custom search excerpts To be used in loop-search.php

Enfold Theme Custom search excerpts

To be used in loop-search.php

<?php

$excerpt = get_the_content();
$excerpt = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $excerpt);  # strip shortcodes, keep shortcode content
$excerpt = strip_tags($excerpt);
echo '<p>'.substr($excerpt, 0, 255).'...</p>';