Skip to content

Instantly share code, notes, and snippets.

@moskowite
Created January 17, 2012 23:21
Show Gist options
  • Save moskowite/1629731 to your computer and use it in GitHub Desktop.
Save moskowite/1629731 to your computer and use it in GitHub Desktop.
<?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