Created
January 17, 2012 23:21
-
-
Save moskowite/1629731 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: Sopa Redirection | |
* Plugin URI: http://oreilly.com/blackout.html | |
* Description: Redirect the blog to oreilly blackout page. | |
* Author: whyisjake, tmoskowite | |
* Version: 1.0 | |
* Author URI: oreilly.com | |
*/ | |
function make_sopa_blackout() { | |
if ( ! is_admin() ) { | |
$current_time = current_time( 'timestamp' ); | |
$start_time = strtotime( '01/17/2012 8:00' ); | |
$end_time = strtotime( '01/17/2012 20:00' ); | |
if( $current_time >= $start_time && $current_time <= $end_time ) { | |
wp_redirect( 'http://oreilly.com/blackout.html', 302 ); | |
exit; | |
} | |
} | |
} | |
add_action( 'init', 'make_sopa_blackout' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment