Created
June 20, 2016 14:27
-
-
Save SErr0r/ac0aedb51230190188b88e9845863951 to your computer and use it in GitHub Desktop.
Divide content at the <! --more--> tag
This file contains hidden or 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 | |
$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