popup (copy)

× document.addEventListener(‘DOMContentLoaded’, function() { var modal = document.getElementById(“myModal”); var span = document.querySelector(“.modal .close”); var buttons = document.querySelectorAll(“.btn.becomeVipBtn”); // Debugging: log to verify modal, span, and buttons elements are found console.log(“Modal:”, modal); console.log(“Close Button:”, span); console.log(“Trigger Buttons:”, buttons); if (modal &&…Continue reading

Filter Countries JUST for Donation Forms

add_filter( ‘charitable_default_donation_fields’, ‘charitable_filter_countries_donation_form’, 10, 1 ); function charitable_filter_countries_donation_form( $donation_fields = array() ) { if ( empty( $donation_fields[‘country’][‘donation_form’][‘options’] ) ) { return $donation_fields; } $countries_for_donation_form = $donation_fields[‘country’][‘donation_form’][‘options’]; // you can remove a country. unset( $countries_for_donation_form[‘CA’] ); // ..or you can create…Continue reading

Increment a Count on Each Form Submission

/** * Increment total entry number on each submission * * @link https://wpforms.com/developers/how-to-increment-a-count-on-each-form-submission */ function wpf_dev_update_total_field( $fields, $entry, $form_data ) { $my_form_id = 1000; // Form ID to track if( $form_data[ ‘id’ ] != $my_form_id ) { return $fields; }…Continue reading

Combine and Minify CSS

function combine_css_files() { wp_enqueue_style(‘combined-styles’, get_template_directory_uri() . ‘/css/combined.min.css’, array(), null, ‘all’); // Dequeue individual files if they are now part of the combined file wp_dequeue_style(‘style-one’); wp_dequeue_style(‘style-two’); } add_action(‘wp_enqueue_scripts’, ‘combine_css_files’);Continue reading

Defer or Async CSS Loading

function async_css($tag, $handle) { // Add ‘async’ to CSS file that you want to load asynchronously if (‘your-style-handle’ !== $handle) { return $tag; } return str_replace(‘ href’, ‘ async=”async” href’, $tag); } add_filter(‘style_loader_tag’, ‘async_css’, 10, 2);Continue reading

Dequeue CSS files conditionally

function remove_unused_css() { // Check if it’s not the homepage or not a specific post type if ( !is_front_page() && !is_page(‘your-page-slug’) ) { wp_dequeue_style(‘unused-stylesheet-handle’); wp_deregister_style(‘unused-stylesheet-handle’); } } add_action(‘wp_enqueue_scripts’, ‘remove_unused_css’);Continue reading