Created
October 6, 2016 10:05
-
-
Save bahiirwa/d773a50708fbd25a3b5f98823a2a296b to your computer and use it in GitHub Desktop.
Using function to limit the characters returned in WordPress
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
I don't quite get your question but his worth a try, if I am understanding you. Add this function to your functions.php or a related file | |
<pre> | |
function get_excerpt2($count){ | |
$permalink = get_permalink($post->ID); | |
$excerpt = get_the_content(); | |
$excerpt = strip_tags($excerpt); | |
$excerpt = substr($excerpt, 0, $count); | |
$excerpt = substr($excerpt, 0, strripos($excerpt, "")); | |
return $excerpt; | |
} | |
"<?php echo <?php echo get_excerpt2(520); ?>...Read More" | |
</pre> | |
And then return this code in your template. You can change the html bits | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment