Last active
August 29, 2015 14:01
-
-
Save BFTrick/e73cfa53cf64182d02ae to your computer and use it in GitHub Desktop.
Doge Home Page WordPress Plugin
This file contains hidden or 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: Doge Home Page | |
| * Plugin URI: https://gist.github.com/BFTrick/e73cfa53cf64182d02ae | |
| * Description: Dogeify the front page of your site | |
| * Author: Patrick Rauland | |
| * Author URI: http://patrickrauland.com/ | |
| * Version: 1.0 | |
| * | |
| * This program is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| * | |
| * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | |
| * | |
| * You should have received a copy of the GNU General Public License | |
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| * | |
| */ | |
| function dhp_content( $content ) { | |
| if ( is_front_page() ) { | |
| $content = dhp_dogify_the_text( $content ); | |
| } | |
| return $content; | |
| } | |
| add_filter( 'the_content', 'dhp_content', 20 ); | |
| // based off: https://twitter.com/Rarst/status/448410532413190144 | |
| function dhp_dogify_the_text( $t ) { | |
| $t=strtolower($t); | |
| $ary = explode( ' ', $t ); | |
| foreach( $ary as $key => $value ){ | |
| $r=rand(1,3); | |
| $ary[$key] = ( 1==$r ) ? 'such ' . $value : ( 2 == $r ? 'very ' . $value : 'wow' ); | |
| } | |
| return implode( ' ', $ary ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment