Home > Etc, UnderCover, Web > Wordpress Word Count

Wordpress Word Count

September 28th, 2007 Leave a comment Go to comments

Wordpress Word Count

(pentru scrierea unui articol / post – admin)

Wordpress Word Count

 

Deschideti fisierul \wp-includes\general-template.php cu un editor (notepad de ex)

Cautati urmatorul text: $the_editor = apply_filters(’the_editor’,

o sa gasiti ceva de genul:

</script>
<?php

$the_editor = apply_filters(’the_editor’, “<div><textarea class=’mceEditor’ $rows cols=’40′ name=’$id’ tabindex=’2′ id=’$id’>%s</textarea></div>\n”);

face’ti urmatoarele modificari:

1). intre liniile </script> si <?php din codul de mai sus scrieti/inserati urmatorul cod javascript:

<script type=”text/javascript”>

String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,”");
}

function wcnt(x)
{
y = tinyMCE.getInstanceById(’content’).getHTML();
var t = y.trim();
var tc = ‘0′;
if ( t ) {
t = t.replace( /<.[^<>]*?>/g, ” );
tc = t.split( /\b[^\w']+\b/ ).length.toString();
}
x.value = tc;
}

</script>

2). intre </textarea>si</div> inserati codul thml de mai jos :

<br />Word Count (move mouse over): <input type=’text’ name=’wc’ value=’0′ size=’5′ onmouseover=’wcnt(this)’ />

Acum nu trebuie decat sa salvati / uploadati fisierul modificat. Intrati in editor …/wp-admin/post-new.php si verificati daca functioneaza.

pentru siguranta salvati vechiul fisier: general-template.php !!!

Daca e prea greu sa urmariti pasii de mai sus puteti downloada fisierul gata modificat pentru WordPress 2.1.3:  http://blog.4rev.net/general-template.zip

 

  1. No comments yet.
  1. No trackbacks yet.
GoCache - ByREV-Cache v1.0 - live served in : 0.159682 sec (gzip)