Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_custom_footer_script() {
- ?>
- <script type="text/javascript">
- document.addEventListener('DOMContentLoaded', function() {
- // Find the first 'ol.campaign-loop li a.button'
- var targetButton = document.querySelector(‘a.button.charitable-button.donate-button');
- // Get all 'a' elements with class "artificial-button"
- var artificialButtons = document.querySelectorAll('a.artificial-button');
- // Add a click event listener to each artificial button
- artificialButtons.forEach(function(artificialButton) {
- artificialButton.addEventListener('click', function(event) {
- event.preventDefault(); // Prevent the default behavior of the artificial button
- if (targetButton) {
- targetButton.click(); // Simulate a click on the actual button
- }
- });
- });
- });
- </script>
- <?php
- }
- add_action('wp_footer', 'add_custom_footer_script');
Advertisement
Add Comment
Please, Sign In to add comment