Skip to content

Instantly share code, notes, and snippets.

@dalethedeveloper
Created July 19, 2011 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalethedeveloper/1093962 to your computer and use it in GitHub Desktop.
Save dalethedeveloper/1093962 to your computer and use it in GitHub Desktop.
Mimic a static HTML file from Wordpress using functions.php
/* 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