Last active
January 12, 2018 16:53
-
-
Save anthonysbrown/8b5346b08e44a155a4958b4b3e892757 to your computer and use it in GitHub Desktop.
Get an excerpt for the visual editor in Enfold. Normally it's blank but this pulls the meta data for the content.
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
<?php | |
echo '<div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>'; | |
$excerpt = trim(get_the_excerpt()); | |
if(!empty($excerpt)) | |
{ | |
the_excerpt(); | |
} | |
else | |
{ | |
$excerpt = strip_tags(apply_filters('the_content',get_post_meta(get_the_id(), '_aviaLayoutBuilderCleanData', true))); | |
if($excerpt){ | |
$excerpt = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $excerpt); | |
$words = explode(" ",$excerpt); | |
$excerpt = implode(" ",array_splice($words,0,50)); | |
$excerpt = str_replace(']]>', ']]>', $excerpt); | |
$excerpt .= ' <a href="'.get_permalink().'">...Read More</a>'; | |
echo $excerpt; | |
} | |
} | |
echo '</div>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment