mirror of
https://github.com/ulaulaman/eduinaf.git
synced 2024-12-17 02:19:31 +01:00
file separato per i contacaratteri
This commit is contained in:
parent
b8b7a5724a
commit
f7eb1fe320
45
incl/conta.php
Normal file
45
incl/conta.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
#contacaratteri
|
||||
|
||||
# Excerpt/Riassunto
|
||||
function excerpt_count_js(){
|
||||
|
||||
if ('page' != get_post_type()) {
|
||||
|
||||
echo '<script>jQuery(document).ready(function(){
|
||||
jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:12px;right:34px;color:#666;\"><small>Numero caratteri: </small><span id=\"excerpt_counter\"></span><span style=\"font-weight:bold; padding-left:7px;\">/ 500</span><small><span style=\"font-weight:bold; padding-left:7px;\">caratteri.</span></small></div>");
|
||||
jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length);
|
||||
jQuery("#excerpt").keyup( function() {
|
||||
if(jQuery(this).val().length > 500){
|
||||
jQuery(this).val(jQuery(this).val().substr(0, 500));
|
||||
}
|
||||
jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length);
|
||||
});
|
||||
});</script>';
|
||||
}
|
||||
}
|
||||
add_action( 'admin_head-post.php', 'excerpt_count_js');
|
||||
add_action( 'admin_head-post-new.php', 'excerpt_count_js');
|
||||
|
||||
# Content/Contenuto
|
||||
function content_char_count() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
wpCharCount = function(txt) {
|
||||
$('.char-count').html("" + txt.length);
|
||||
};
|
||||
$(document).ready(function() {
|
||||
$('#wp-word-count').append('<br />Numero caratteri: <span class="char-count">0</span>');
|
||||
}).bind( 'wpcountwords', function(e, txt) {
|
||||
wpCharCount(txt);
|
||||
});
|
||||
$('#content').bind('keyup', function() {
|
||||
wpCharCount($('#content').val());
|
||||
});
|
||||
}(jQuery));
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action('dbx_post_sidebar', 'content_char_count');
|
Loading…
Reference in New Issue
Block a user