mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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:
+29
-1
@@ -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");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user