Skip to content

Instantly share code, notes, and snippets.

@SErr0r
Created June 20, 2016 14:27
Show Gist options
  • Save SErr0r/ac0aedb51230190188b88e9845863951 to your computer and use it in GitHub Desktop.
Save SErr0r/ac0aedb51230190188b88e9845863951 to your computer and use it in GitHub Desktop.
Divide content at the <! --more--> tag
<?php
$description = get_field('descripton');
if( strpos($description, '<!--more-->') >= 1 ) {
$more_position = 11 + strpos($description, '<!--more-->');
$before_more = substr($description, 0, $more_position);
$after_more = substr($description, $more_position); ?>
<div class="excerpt">
<?php echo $before_more; ?>
</div>
<div class="read-more">
<?php echo $after_more; ?>
</div>
<?php } else {
the_field('description');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment