| 1 |
<?php defined( 'ABSPATH' ) or die; |
| 2 |
/* @var PixCustomifyFormField $field */ |
| 3 |
/* @var PixCustomifyForm $form */ |
| 4 |
/* @var mixed $default */ |
| 5 |
/* @var string $name */ |
| 6 |
/* @var string $idname */ |
| 7 |
/* @var string $label */ |
| 8 |
/* @var string $desc */ |
| 9 |
/* @var string $rendering */ |
| 10 |
|
| 11 |
// [!!] the counter field needs to be able to work inside other fields; if |
| 12 |
// the field is in another field it will have a null label |
| 13 |
|
| 14 |
$selected = $form->autovalue( $name, $default ); |
| 15 |
|
| 16 |
$config = apply_filters('customify_filter_fields', array() ); |
| 17 |
|
| 18 |
$key = $config[ 'opt-name' ]; |
| 19 |
|
| 20 |
$mods = get_theme_mods(); |
| 21 |
|
| 22 |
$option = get_option( 'pixcustomify_settings' ); |
| 23 |
|
| 24 |
$attrs = array( |
| 25 |
'type' => 'checkbox', |
| 26 |
); ?> |
| 27 |
<div class="reset_customify_theme_mod"> |
| 28 |
<div class="button" id="reset_theme_mods"><?php esc_html_e( 'Reset Theme Mods', 'customify' ); ?></div> |
| 29 |
<script> |
| 30 |
(function ($) { |
| 31 |
$(document).ready(function () { |
| 32 |
$('#reset_theme_mods').on('click', function () { |
| 33 |
var confirm = window.confirm('Are you sure?'); |
| 34 |
|
| 35 |
if ( ! confirm ) { |
| 36 |
return false; |
| 37 |
} |
| 38 |
|
| 39 |
$.ajax({ |
| 40 |
url: customify_settings.wp_rest.root + 'customify/v1/delete_theme_mod', |
| 41 |
method: 'POST', |
| 42 |
beforeSend: function (xhr) { |
| 43 |
xhr.setRequestHeader('X-WP-Nonce', customify_settings.wp_rest.nonce); |
| 44 |
}, |
| 45 |
data: { |
| 46 |
'customify_settings_nonce': customify_settings.wp_rest.customify_settings_nonce |
| 47 |
} |
| 48 |
}).done(function (response) { |
| 49 |
if ( response.success ) { |
| 50 |
alert( 'Success: ' + response.data ); |
| 51 |
} else { |
| 52 |
alert( 'No luck: ' + response.data ); |
| 53 |
} |
| 54 |
}).error(function (e) { |
| 55 |
console.log(e); |
| 56 |
}); |
| 57 |
}); |
| 58 |
}); |
| 59 |
|
| 60 |
})(jQuery) |
| 61 |
</script> |
| 62 |
</div> |
| 63 |
<br> |
| 64 |
<div class="field-desc"><?php esc_html_e('Resets all the Customizer settings introduced by the plugin. It will NOT reset core Customizer settings or plugin settings.'); ?></div> |
| 65 |
|