Skip to content

Instantly share code, notes, and snippets.

@rickbenetti
Created September 27, 2011 23:51
Show Gist options
  • Save rickbenetti/1246589 to your computer and use it in GitHub Desktop.
Save rickbenetti/1246589 to your computer and use it in GitHub Desktop.
Exibir quantidade de caracteres no box de resumo
// Adicionar codigo abaixo dentro do functions do template em uso
// Contagem de caracteres do excerpt
function excerpt_count_js(){
echo ' <script>
jQuery(function($) {
$("#postexcerpt textarea").after("<div style=\"float: rigth;margin: 10px;;color:#666;\"><small>Quantidade de caracteres: </small><input type=\"text\" value=\"0\" maxlength=\"3\" size=\"3\" id=\"excerpt_counter\" readonly=\"\" style=\"background:#fff;\">.</div>");
$("#excerpt_counter").val($("#excerpt").val().length);
$("#excerpt").keyup( function() {
$("#excerpt_counter").val($("#excerpt").val().length);
});
});</script>';
}
add_action( 'admin_head-post.php', 'excerpt_count_js');
add_action( 'admin_head-post-new.php', 'excerpt_count_js');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment