Skip to content

Instantly share code, notes, and snippets.

@smiler
Created November 13, 2013 14:05
Show Gist options
  • Save smiler/7449638 to your computer and use it in GitHub Desktop.
Save smiler/7449638 to your computer and use it in GitHub Desktop.
<?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