本文整理汇总了PHP中remove_theme_mods函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_theme_mods函数的具体用法?PHP remove_theme_mods怎么用?PHP remove_theme_mods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_theme_mods函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
function uninstall()
{
delete_option('k2headerimage');
delete_option('k2hometab');
delete_option('k2hometabcustom');
remove_theme_mods();
}
示例2: reset_sanitize_callback
public function reset_sanitize_callback($input)
{
if ('reset' == strtolower($input)) {
remove_theme_mods();
}
return '';
}
示例3: sanitize
/**
* Sanitization callback
*
* @since 1.6.0
*/
public static function sanitize($options)
{
// Import the imported options
if ($options) {
// Delete options if import set to -1
if ('-1' == $options['reset']) {
// Get menu locations
$locations = get_theme_mod('nav_menu_locations');
$save_menus = array();
if ($locations) {
foreach ($locations as $key => $val) {
$save_menus[$key] = $val;
}
}
// Get sidebars
$widget_areas = get_theme_mod('widget_areas');
// Remove all mods
remove_theme_mods();
// Remove CSS cache
delete_option('wpex_customizer_inline_css_cache');
// Re-add the menus
set_theme_mod('nav_menu_locations', array_map('absint', $save_menus));
set_theme_mod('widget_areas', $widget_areas);
// Error messages
$error_msg = __('All settings have been reset.', 'wpex');
$error_type = 'updated';
} elseif (!empty($options['import'])) {
// Decode input data
$theme_mods = json_decode($options['import'], true);
// Validate json file then set new theme options
if (function_exists('json_last_error')) {
if ('0' == json_last_error()) {
// Delete CSS cache
delete_option('wpex_customizer_inline_css_cache');
// Loop through mods and add them
foreach ($theme_mods as $theme_mod => $value) {
set_theme_mod($theme_mod, $value);
}
// Success message
$error_msg = __('Settings imported successfully.', 'wpex');
$error_type = 'updated';
} else {
$error_msg = __('Invalid Import Data.', 'wpex');
$error_type = 'error';
}
}
} else {
$error_msg = __('No import data found.', 'wpex');
$error_type = 'error';
}
// Make sure the settings data is reset!
$options = array('import' => '', 'reset' => '');
}
// Display message
add_settings_error('wpex-customizer-notices', esc_attr('settings_updated'), $error_msg, $error_type);
// Return options
return $options;
}
示例4: the_wp_reset_all_settings
/**
* Reset all settings to default
* @param $input entered value
* @return sanitized output
*
*/
function the_wp_reset_all_settings($input)
{
if ($input == 1) {
//Remove all set values
remove_theme_mods();
} else {
return '';
}
}
示例5: wptouch_customizer_reset_settings
function wptouch_customizer_reset_settings()
{
// Called when the user resets WPtouch settings. WPtouch handles the settings object side, but we also need to clear out the data structures used by the Customizer. Settings defaults will be applied as normal.
global $wptouch_pro;
// Delete site option structures; no need to restrict these to the known options domains (n.b.: others should not exist at this point).
$domains = $wptouch_pro->get_active_setting_domains();
foreach ($domains as $domain) {
delete_option('wptouch_customizer_options_' . $domain);
}
// Rebuild settings and objects from the WPtouch objects (e.g., defaults)
$current_theme = wptouch_get_current_theme_name();
delete_option('wptouch_customizer_initialized_' . $current_theme);
// Delete theme mods – because we're not actively customizing here, WP believes the desktop theme is active, so override the value for the duration of the action. Disable the override once we're done so later requests execute normally.
wptouch_customizer_begin_theme_override();
remove_theme_mods();
wptouch_customizer_end_theme_override();
}
示例6: take_action
function take_action()
{
if (isset($_POST['textcolor'])) {
check_admin_referer('custom-header');
if ('blank' == $_POST['textcolor']) {
set_theme_mod('header_textcolor', 'blank');
} else {
$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']);
if (strlen($color) == 6 || strlen($color) == 3) {
set_theme_mod('header_textcolor', $color);
}
}
}
if (isset($_POST['resetheader'])) {
check_admin_referer('custom-header');
remove_theme_mods();
}
}
示例7: aaron_sanitize_reset
function aaron_sanitize_reset($input)
{
$input = sanitize_text_field($input);
if ($input == 'YES') {
remove_theme_mods();
} else {
return;
}
}
示例8: _reset_settings
protected function _reset_settings($arrSettings = false)
{
$return = false;
if (empty($arrSettings)) {
// early abort
return $return;
}
foreach ($arrSettings as $strDataItemID => $arrItemAttributes) {
switch ($strDataItemID) {
case 'theme_mods':
// customizer / theme-specific settings
set_theme_mod('theme_mods_reset', time());
remove_theme_mods();
set_theme_mod('color_scheme', 'default');
if (get_theme_mod('theme_mods_reset', true) == true) {
// has been set BEFORE removing all theme_mods .. should return true, instead of an integer!
$resetStatus = true;
}
break;
case 'slideshows':
// alias for another option name
$resetStatus = delete_option('cc_slider_options');
break;
default:
$resetStatus = delete_option($arrItemAttributes['option_name']);
break;
}
$arrReturn[$strDataItemID] = array('title' => $arrItemAttributes['title'], 'status' => $resetStatus);
unset($resetStatus);
}
if (!empty($arrReturn)) {
$return = $arrReturn;
}
return $return;
}
示例9: array
/* UU 2014 - Image Selection
========================================================================== */
$wp_customize->add_section('uu2014_choose_images_section', array('title' => __('UU 2014 - Image Selection', 'uu2014'), 'priority' => 100030, 'description' => __('You can choose what style of UU image to display in the theme.', 'uu2014')));
$wp_customize->add_setting('uu2014_title_image', array('default' => 'Symbol_Gradient_77_110.png', 'sanitize_callback' => 'sanitize_file_name'));
$wp_customize->add_control('uu2014_title_image_dropdown', array('label' => __('Which image should be displayed near the title?', 'uu2014'), 'section' => 'uu2014_choose_images_section', 'settings' => 'uu2014_title_image', 'type' => 'select', 'choices' => array('chalice.png' => 'Silver Chalice', 'Symbol_Metal_77_110.png' => __('Silver UUA Symbol', 'uu2014'), 'Symbol_Metal_77_71.png' => __('Smaller Silver UUA Symbol', 'uu2014'), 'Symbol_Gradient_77_110.png' => __('Red UUA Symbol', 'uu2014'), 'Symbol_Gradient_77_71.png' => __('Smaller Red UUA Symbol', 'uu2014'))));
$wp_customize->add_setting('uu2014_footer_image', array('default' => 'UUA_Symbol_dark_148_200.png', 'sanitize_callback' => 'sanitize_file_name'));
$wp_customize->add_control('uu2014_footer_image_dropdown', array('label' => __('Which image should be displayed in the footer?', 'uu2014'), 'section' => 'uu2014_choose_images_section', 'settings' => 'uu2014_footer_image', 'type' => 'select', 'choices' => array('chalice-watermark-dark.gif' => __('Dark Chalice', 'uu2014'), 'UUA_Symbol_dark_148_200.png' => __('Dark UUA Symbol', 'uu2014'))));
$wp_customize->add_setting('uu2014_favicon', array('default' => 'favicon.ico', 'sanitize_callback' => 'sanitize_file_name'));
$wp_customize->add_control('uu2014_favicon_dropdown', array('label' => __('Which image should be used for the website icon(favicon)?', 'uu2014'), 'section' => 'uu2014_choose_images_section', 'settings' => 'uu2014_favicon', 'type' => 'select', 'choices' => array('favicon.ico' => __('New Red UUA Symbol', 'uu2014'), 'chalice-favicon.ico' => __('Previous Chalice UUA Symbol', 'uu2014'))));
/* ========================================================================== */
}
add_action('customize_register', 'uu2014_customize_register');
// If the user clicked the reset button, remove all theme modifications
// It is important that the default is false or you would reset every time
if (get_theme_mod('uu2014_theme_reset_setting', 0)) {
remove_theme_mods();
}
//We have a small amount of dynamic CSS that is output in the header
function uu2014_customize_css()
{
?>
<style type="text/css" id="uu2014_customize_css">
<?php
$uu2014_font_size_settings = uu2014_get_font_size_settings();
foreach ($uu2014_font_size_settings as $font_size_setting => $value) {
?>
<?php
echo $value['selector'];
?>
{ <?php
echo get_theme_mod($font_size_setting, $value['font-size-default']);
示例10: uninstall
function uninstall()
{
delete_option('k2headerimage');
delete_option('k2blogornoblog');
remove_theme_mods();
}
示例11: take_action
/**
* Execute custom header modification.
*
* @since 2.6.0
*/
function take_action()
{
if (!current_user_can('switch_themes')) {
return;
}
if (isset($_POST['textcolor'])) {
check_admin_referer('custom-header');
if ('blank' == $_POST['textcolor']) {
set_theme_mod('header_textcolor', 'blank');
} else {
$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']);
if (strlen($color) == 6 || strlen($color) == 3) {
set_theme_mod('header_textcolor', $color);
}
}
}
if (isset($_POST['resetheader'])) {
check_admin_referer('custom-header');
remove_theme_mods();
}
if (isset($_POST['default-header'])) {
check_admin_referer('custom-header');
$this->process_default_headers();
if (isset($this->default_headers[$_POST['default-header']])) {
set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url']));
}
}
}
示例12: validate
/**
* Trigger the compiler and reset cached CSS on save.
* This is necessary for the imports to properly work.
*/
function validate($settings)
{
// Import the imported options
if (isset($settings['import_data']) && !empty($settings['import_data'])) {
if ('RESET' == $settings['import_data']) {
remove_theme_mods();
} else {
$theme_mods = json_decode($settings['import_data'], true);
foreach ($theme_mods as $theme_mod => $value) {
set_theme_mod($theme_mod, $value);
}
}
// The import data should not be saved, save the field as empty.
$settings['import_data'] = '';
}
do_action('maera/admin/save');
return $settings;
}
示例13: remove_theme_mod
/**
* Remove theme modification name from current theme list.
*
* If removing the name also removes all elements, then the entire option will
* be removed.
*
* @since 2.1.0
*
* @param string $name Theme modification name.
* @return null
*/
function remove_theme_mod($name)
{
$mods = get_theme_mods();
if (!isset($mods[$name])) {
return;
}
unset($mods[$name]);
if (empty($mods)) {
return remove_theme_mods();
}
$theme = get_option('stylesheet');
update_option("theme_mods_{$theme}", $mods);
}
示例14: raindrops_delete_all_options
function raindrops_delete_all_options()
{
if (current_user_can('delete_themes')) {
delete_option('raindrops_theme_settings');
remove_theme_mods();
delete_option('widget_raindrops_pinup_entry_widget');
delete_option('widget_raindrops_entrywidget');
$allposts = get_posts('numberposts=0&post_type=post&post_status=');
foreach ($allposts as $postinfo) {
delete_post_meta($postinfo->ID, '_web_fonts_styles');
delete_post_meta($postinfo->ID, '_web_fonts_link_element');
delete_post_meta($postinfo->ID, '_css');
delete_post_meta($postinfo->ID, 'css');
delete_post_meta($postinfo->ID, '_add-to-front');
delete_post_meta($postinfo->ID, '_raindrops_this_header_image');
delete_post_meta($postinfo->ID, 'meta');
if (RAINDROPS_CUSTOM_FIELD_SCRIPT == true) {
delete_post_meta($postinfo->ID, 'javascript');
}
}
$allposts = get_posts('numberposts=0&post_type=page&post_status=');
foreach ($allposts as $postinfo) {
delete_post_meta($postinfo->ID, '_web_fonts_styles');
delete_post_meta($postinfo->ID, '_web_fonts_link_element');
delete_post_meta($postinfo->ID, '_css');
delete_post_meta($postinfo->ID, 'css');
delete_post_meta($postinfo->ID, '_add-to-front');
delete_post_meta($postinfo->ID, '_raindrops_this_header_image');
delete_post_meta($postinfo->ID, 'meta');
if (RAINDROPS_CUSTOM_FIELD_SCRIPT == true) {
delete_post_meta($postinfo->ID, 'javascript');
}
}
}
}
示例15: remove_theme_mod
/**
* Remove theme modification name from current theme list.
*
* If removing the name also removes all elements, then the entire option will
* be removed.
*
* @since 2.1.0
*
* @param string $name Theme modification name.
* @return null
*/
function remove_theme_mod($name)
{
$theme = get_current_theme();
$mods = get_option("mods_{$theme}");
if (!isset($mods[$name])) {
return;
}
unset($mods[$name]);
if (empty($mods)) {
return remove_theme_mods();
}
update_option("mods_{$theme}", $mods);
wp_cache_delete("mods_{$theme}", 'options');
}