Customize Recurring Add-on Template
-
I’d like to inject an SVG into the .give-recurring-donors-choice element (a heart next to the recurring option).
I can inject JS that fires when the form loads, but since we’re using a multiple step form, it doesn’t fire for the second step in the form!I initially tried to append the img to the element with JS,.. but it wasn’t working.
Upon further inspection I see the JS is loading when the page loads, but does NOT append the image to the element which is on step two of the form.I thought maybe the steps were causing the issue and so I added an on click listener to the Donate Now button, that triggers the second stage of the form to load… it still doesn’t fire for the target element.
Here is the code:
function override_givewp_js() { ?> <script type="text/javascript"> alert('script is included in page'); // this fires jQuery(document).ready( function($) { $('.give-btn.advance-btn').on('click', function(){ alert('button clicked'); // this doesn't fire on click of the Donate Now button, which takes you to the next step - I previously omitted this, but the following lines won't fire with or without it if( $('.give-recurring-donors-choice').length ){ alert('should be loading'); // not loading... tried adding the on click function above to look for this element AFTER the Donate Now button was clicked and form loads second step of the form.. no dice. $('.give-recurring-donors-choice').append('<img src="/wp-content/themes/vertex-ranch-2022/assets/img/icons/solid/love.svg" class="svg-inject icon-svg icon-svg-xs solid-mono text-primary" alt="?" />'); } }); }); // docready </script> <?php } add_action('wp_print_scripts', 'override_givewp_js', 10);
Thoughts or other ways to add an icon to the form element without hacking plugin files??
** Does GiveWP allow template override files (like woocommerce) where I can duplicate a form template into a theme folder and override it ???
The page I need help with: [log in to see the link]
- The topic ‘Customize Recurring Add-on Template’ is closed to new replies.