Created
November 13, 2013 14:05
-
-
Save smiler/7449638 to your computer and use it in GitHub Desktop.
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 | |
/* | |
* Plugin Name: Bleh | |
* Description: Add bleh, blark or something to end of each sentence. | |
* Author: Christian Axelsson | |
* Version: 0.1 | |
*/ | |
function bleh_blehify_content( $content ) { | |
$sentences = array_filter( explode( ".", $content ), "strlen" ); | |
return array_reduce( $sentences, 'bleh_make_bleh', "" ); | |
} | |
function bleh_make_bleh( $result, $str ) { | |
$blehs = array( "bleh", "blah", "blergh", "bloh", "blurf", "blesk", "blaf" ); | |
$bleh = $blehs[ rand( 0, count( $blehs ) - 1 ) ]; | |
return $result . "$str, $bleh."; | |
} | |
add_filter( 'the_content', 'bleh_blehify_content', 9 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment