Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

gianficaro on "max character help"

$
0
0

on the home page i have the max characters limited for design reasons to keep everything at a same level design so some post are not longer then others but its not counting the white spaces as a character and it makes other posts longer

i have this in functions

/* set max characters in articles and posts. */

function get_excerpt($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;
}

and this in index

<?php echo get_excerpt(250); ?>


Viewing all articles
Browse latest Browse all 8245

Trending Articles