Skip to content

Instantly share code, notes, and snippets.

@rickalday
Created October 29, 2025 23:18
Show Gist options
  • Select an option

  • Save rickalday/d0fb8b5bb2426ae7ae08344c310ef842 to your computer and use it in GitHub Desktop.

Select an option

Save rickalday/d0fb8b5bb2426ae7ae08344c310ef842 to your computer and use it in GitHub Desktop.
Change GiveWP's primary and secondary form colors
<?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