Created
July 19, 2011 23:01
-
-
Save dalethedeveloper/1093962 to your computer and use it in GitHub Desktop.
Mimic a static HTML file from Wordpress using functions.php
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
/* When an html page like URL is accessed, return some static content, | |
In this case, a verification page for Google Apps | |
In the current theme functions.php: | |
*/ | |
if( !class_exists('google_verify') ) { | |
class google_verify { | |
public function __construct() { | |
add_filter('rewrite_rules_array', array($this,'gv_rewrite') ); | |
if( !is_admin() ) { | |
add_filter('query_vars', array($this,'gv_queryvars') ); | |
add_filter('wp_headers', array($this,'gv_output') ); | |
} | |
} | |
public function gv_queryvars($qvars) { | |
$qvars[] = 'gv_flag'; | |
return $qvars; | |
} | |
public function gv_rewrite($wprw = array()) { | |
return array('googlehostedservice.html/?$' => 'index.php?gv_flag=1') + $wprw; | |
} | |
public function gv_output($headers) { | |
global $wp; | |
if( !empty($wp->query_vars) and isset($wp->query_vars['gv_flag']) and $wp->query_vars['gv_flag'] == 1 ) { | |
die('google4255e00b32ef3c4'); | |
} | |
} | |
} | |
$google_verify = new google_verify(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment