Hey Esmi, admin plugin works well in the backend, but thought I'd try a better solution so that it workd in the frontend too. As i want to display the character count in the frontend, so the plugin available isn't the best. A friend made this plugin for me. It displays the characters used for each post.
<?php
//ADD FILTERS
add_filter('the_content', 'char_count_func');
function char_count_func($text)
{
$count = strlen($text);
if(is_page())
return $text;
else
return $text.'<br/><b>'.$count.' characters including spaces.</b>';
}
?>
The problem with it is that punction symbols and line breaks are counted as more than one character. Is there a way to adjust this to count all symbols and line breaks as 1 character. Also how would you restrict this from certain post?
note: I found this code in another plugin which I think addreses the symbol count issue, but not the line break.
function get_characters() {
if ($this->text == '') { return(0); }
if ($this->characters != -1) { return($this->characters); }
$count = strlen(utf8_decode($this->text));
$this->characters = $count;
return($count);
}
Thanks