Some helper functions for themes and images

git-svn-id: https://develop.svn.wordpress.org/trunk@4401 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2006-10-16 06:06:18 +00:00
parent 51367ff351
commit e37451b79a
2 changed files with 77 additions and 2 deletions
+29 -1
View File
@@ -427,4 +427,32 @@ function validate_current_theme() {
return true;
}
?>
function get_theme_mod($name, $default = false) {
$theme = get_current_theme();
$mods = get_option("mods_$theme");
if ( isset($mods[$name]) )
return $mods[$name];
return sprintf($default, get_template_directory_uri());
}
function set_theme_mod($name, $value) {
$theme = get_current_theme();
$mods = get_option("mods_$theme");
$mods[$name] = $value;
update_option("mods_$theme", $mods);
wp_cache_delete("mods_$theme", 'options');
}
function remove_theme_mods() {
$theme = get_current_theme();
delete_option("mods_$theme");
}
?>