Skip to content

Instantly share code, notes, and snippets.

@thegulshankumar
Last active August 22, 2024 10:58
Show Gist options
  • Save thegulshankumar/59d98adf904e1fdc1e0dfacea8cff9ac to your computer and use it in GitHub Desktop.
Save thegulshankumar/59d98adf904e1fdc1e0dfacea8cff9ac to your computer and use it in GitHub Desktop.
Checkbox Enabler for Feedify Push Notifications System
<?php // Skip this line, beautification only. Start copying from Line #2.
function add_feedify_checkbox_enabler() {
?>
<script type="text/javascript">
(function($) {
$(document).ready(function() {
function enableFeedifyCheckbox() {
var checkbox = $('#s_f_noti');
if (checkbox.length) {
checkbox.prop('disabled', false).prop('checked', true);
}
}
enableFeedifyCheckbox();
if (window.wp && wp.data && wp.data.subscribe) {
wp.data.subscribe(function () {
setTimeout(enableFeedifyCheckbox, 100);
});
}
});
})(jQuery);
</script>
<?php
}
add_action('admin_footer', 'add_feedify_checkbox_enabler');
@thegulshankumar
Copy link
Author

If you're using the Feedify plugin and want to enable Push Notifications for all posts by default, this snippet automatically checks the 'Send Notification' checkbox. Normally, this option is unchecked. You can add this snippet to your functions.php file or use the Code Snippets plugin to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment