How to Add Character Counter to Excerpt Metabox

Add Tool

Add Character Counter to Excerpt Metabox


Add Character Counter to Excerpt Metabox

Adding this snippet to the functions.php of your WordPress theme excerpt box will support character counter. As a result you will be able to understand how many character you have used for excerpt post.

function excerpt_count_js(){
echo '<script>jQuery(document).ready(function(){
jQuery("#postexcerpt .handlediv").after("<div style="position:absolute;top:0px;right:5px;color:#666;"><small>Excerpt length: </small><input type="text" value="0" maxlength="3" size="3" id="excerpt_counter" readonly="" style="background:#fff;"> <small>character(s).</small></div>");
     jQuery("#excerpt_counter").val(jQuery("#excerpt").val().length);
     jQuery("#excerpt").keyup( function() {
     jQuery("#excerpt_counter").val(jQuery("#excerpt").val().length);
   });
});</script>';
}
add_action( 'admin_head-post.php', 'excerpt_count_js');
add_action( 'admin_head-post-new.php', 'excerpt_count_js');

After adding the above snippet in your template’s functions.php file your excerpt metabox will see like below

add character counter to excerpt metabox


Source file


Tags: character counter, excerpt metabox wordpress, functions.php, metaboxes, WordPress, wordpress excerpt, wordpress hack, wordpress post editor
Payza

About Masum Billah

Add Character Counter to Excerpt Metabox 1stWebSuite website seo tool is a free website ranking tool site provides a lot of on page and off page seo useful tools for you. On this site, we have a large number of website ranking tools


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: How to Add Character Counter to Excerpt Metabox


adf.ly