Skip to content

Instantly share code, notes, and snippets.

@anthonysbrown
Last active January 12, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonysbrown/8b5346b08e44a155a4958b4b3e892757 to your computer and use it in GitHub Desktop.
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.
<?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(']]>', ']]&gt;', $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