Created
October 29, 2025 23:18
-
-
Save rickalday/d0fb8b5bb2426ae7ae08344c310ef842 to your computer and use it in GitHub Desktop.
Change GiveWP's primary and secondary form colors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Remove the inline styles from the doantion receipt page | |
| add_action('wp_print_scripts', function () { | |
| wp_add_inline_script('givewp-donation-confirmation-receipt', 'document.addEventListener("DOMContentLoaded", function () { | |
| // Run after a short delay to ensure UI is ready | |
| setTimeout(() => { | |
| const element = document.getElementById("root-givewp-donation-confirmation-receipt"); | |
| element.removeAttribute("style"); | |
| }, 10); // small delay to let GiveWP UI finish rendering | |
| });', 'before'); | |
| }); | |
| //Add our custom CSS | |
| add_action( 'wp_print_styles', function() { | |
| // 1. Remove the existing inline style | |
| wp_styles()->add_data( 'givewp-base-form-styles', 'after', '' ); | |
| // 2. Add the new inline styles | |
| $new_css = " | |
| :root { | |
| --givewp-primary-color: red !important; | |
| --givewp-secondary-color: blue !important; | |
| } | |
| "; | |
| wp_add_inline_style( 'givewp-base-form-styles', $new_css ); | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment