Skip to content

Instantly share code, notes, and snippets.

@miya0001
Created May 10, 2011 19:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miya0001/965215 to your computer and use it in GitHub Desktop.
Save miya0001/965215 to your computer and use it in GitHub Desktop.
switch theme class for wordpress plugin
<?php
class switchTheme {
private $name = null;
private $dir = null;
private $url = null;
function __construct($name = null, $dir = null, $url = null)
{
$this->name = $name;
$this->dir = $dir;
$this->url = $url;
add_filter("show_admin_bar", "__return_false");
add_filter("stylesheet", array(&$this, "template"));
add_filter("template", array(&$this, "template"));
add_filter("theme_root", array(&$this, "theme_root"));
add_filter("theme_root_uri", array(&$this, "theme_root_uri"));
}
public function template($name)
{
if ($this->name) {
return $this->name;
} else {
return $name;
}
}
public function theme_root($dir)
{
if ($this->dir) {
return $this->dir;
} else {
return $dir;
}
}
public function theme_root_uri($url)
{
if ($this->url) {
return $this->url;
} else {
return $url;
}
}
}
?>
@miya0001
Copy link
Author

詳細は以下のページで。
http://firegoby.theta.ne.jp/archives/2251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment