Skip to content

Instantly share code, notes, and snippets.

@hissy
Created January 16, 2013 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hissy/4547967 to your computer and use it in GitHub Desktop.
Save hissy/4547967 to your computer and use it in GitHub Desktop.
[WordPress] "/about/" というURLにアクセスした時だけ Twenty Ten に切り替える
<?php
/*
Plugin Name: Hardcode theme switcher
Plugin URI: http://ja.forums.wordpress.org/topic/13483
Author: Takuro Hishikawa
Version: 0.1
*/
function my_theme_switcher($theme){
// yes, it's hardcoded!
if ( $_SERVER['REQUEST_URI'] == '/about/' ) {
$overrideTheme = wp_get_theme('twentyten');
if ( $overrideTheme->exists() ) {
return $overrideTheme['Template'];
} else {
return $theme;
}
}
return $theme;
}
add_filter('stylesheet', 'my_theme_switcher', 50);
add_filter('template', 'my_theme_switcher', 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment