Cannot get Loading .gif file Contact Form 7 working

Hi I cannot get the loading .gif file working on a website I am creating for a client.

I have tried suggested code on this forum on this topic https://theme.co/apex/forum/t/contact-form-7-adding-a-loading-gif/15176

I tired the suggested code which is as follows:

add_action('wp_head', 'add_loader_gif');

function add_loader_gif() {
echo '<style>.wpcf7 .ajax-loader{background-image: url('. plugins_url() .'/contact-form-7/images/ajax-loader.gif);visibility:hidden;display:inline-block;width:16px;height:16px;border:none;padding:0;margin:0 0 0 4px;vertical-align:middle}.wpcf7 .ajax-loader.is-active{visibility:visible}</style>';
}

I tried placing this in my X-Theme Child theme using the WordPress editor but I cannot get the .gif to load

The site I am working on is here: https://www.physicsproof.com/

Happy to share login details if requested privately

Many Thanks,

Shane :slight_smile:

Hi Shane,

Thank you for writing in, the code provided on that other thread still works on my end, try the following code:

// Add loading gif to contact form
// =============================================================================
add_action('wp_head', 'add_loader_gif');
function add_loader_gif() {
  echo '<style>.wpcf7 .ajax-loader{background-image: url('. plugins_url() .'/contact-form-7/images/ajax-loader.gif);visibility:hidden;display:inline-block;width:16px;height:16px;border:none;padding:0;margin:0 0 0 4px;vertical-align:middle}.wpcf7 .ajax-loader.is-active{visibility:visible}</style>';
}
// =============================================================================

And make sure you place it on the Child theme’s functions.php file.

Thanks,

1 Like

Hi @friech

Many thanks for your response!

I cannot seem to update either piece of code in the editor within WordPress.

I get the following error:

> "Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP."

Image attached below of what I am seeing.

Hope this helps?

Many thanks for your help!

Shane :grinning:

UPDATE

Thanks @friech that code works I just had to edit it manually through my cPanel account with the hosting company in the functions.php file in X-Theme’s Child Theme.

Thanks so much for your help! :slight_smile:

Shane

We are delighted to assist you with this.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.