Created
May 3, 2017 02:32
-
-
Save brunopulis/9234f153ded37ca089c71ed26a31a723 to your computer and use it in GitHub Desktop.
get_content
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
/** | |
* content | |
* | |
* Limit the size of text | |
* | |
* @param int $limit quantity to excerpt | |
* @return void | |
*/ | |
function content($limit) { | |
$content = explode(' ', get_the_content(), $limit); | |
if ( count( $content ) >= $limit ): | |
array_pop($content); | |
$content = implode(" ",$content).'...'; | |
else: | |
$content = implode(" ",$content); | |
endif; | |
$content = preg_replace('/[.+]/','', $content); | |
$content = apply_filters('the_content', $content); | |
$content = str_replace(']]>', ']]>', $content); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment