add files inc
This commit is contained in:
38
inc/admin/auto_check.php
Normal file
38
inc/admin/auto_check.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
function add_auto_check_script_to_post_edit() {
|
||||
$screen = get_current_screen();
|
||||
if ($screen && $screen->base === 'post') {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
// Проверяем, что это новый пост
|
||||
if (window.location.href.indexOf('post-new.php') > -1) {
|
||||
// Ждем загрузки DOM
|
||||
setTimeout(function() {
|
||||
// Устанавливаем атрибут checked="checked" для нужных чекбоксов
|
||||
const checkboxes = [
|
||||
'input[name="yzrssenabled_meta_value"][type="checkbox"]',
|
||||
'input[name="ynrss_exclude"][type="checkbox"]',
|
||||
'input[name="_send_telegram"][type="checkbox"]'
|
||||
//'input[name="_hide_on_mainpage"][type="checkbox"]',
|
||||
// Добавьте другие чекбоксы здесь:
|
||||
// 'input[name="_another_field"][type="checkbox"]',
|
||||
];
|
||||
|
||||
checkboxes.forEach(function(selector) {
|
||||
const $checkbox = $(selector);
|
||||
if ($checkbox.length) {
|
||||
$checkbox.attr('checked', 'checked');
|
||||
$checkbox.prop('checked', true);
|
||||
//console.log('Установлен checked для:', selector);
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action('admin_footer', 'add_auto_check_script_to_post_edit');
|
||||
Reference in New Issue
Block a user