Last active
January 28, 2016 07:08
-
-
Save pixelbart/4ea6c7d296c3459c932f to your computer and use it in GitHub Desktop.
Wortzähler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ein simpler Wortzähler für deine Website | |
* Ausgabe: <p><?php echo word_counter(); ?></p> | |
*/ | |
function word_counter() { | |
return sprintf( | |
__( '%s Wörter', 'Textdomain' ), // Für Übersetzungen! %s wird ersetzt mit der Wortanzahl | |
str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ) ) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment