How to Add a Preloader Animation to WordPress (Step by Step)

By WP Saviour •  Updated: 09/27/20 •  6 min read

Do it is advisable to add a preloader to your WordPress web site? A preloader is an animation indicating the progress of a page-load inside the background.

Preloaders assure clients that the website online is engaged on loading the online web page. This may assist improve particular person experience and in the reduction of the overall bounce value.

On this text, we’ll current you learn to merely add a preloader to WordPress.

wppreloaderhowto-6721190

What’s a Preloader and When You Should Use it?

A preloader is an animation or standing message indicating the progress of page-load inside the background.

Normally whilst you go to an web web site, your browser begins downloading fully totally different parts of the content material materials. Some parts of the website online load sooner (i.e. textual content material, HTML code, CSS) whereas others load means slower (i.e images and films).

If most of your content material materials is textual content material with just a few images and films, you then undoubtedly don’t really need in order so as to add a preloader to your website online. As a substitute, it is best to take care of bettering website online velocity and effectivity for sooner net web page lots of.

Nonetheless, if most of your content material materials is images, photos, and video embeds, then your clients wish to attend a while sooner than they’ll actually see all the content material materials.

All through these partial downloads, your website online may actually really feel sluggish. Usually clients may even assume that it is broken. Together with a preloader fills this gap and reveals the particular person a progress indicator all through the online web page load.

You can see a keep occasion of a preloader by clicking on the Preview button whereas writing a weblog put up in WordPress.

WordPress will open a keep preview of your weblog put up in a model new window, and it will present a preloader sooner than it actually reveals the keep preview.

wppostpreview-9125862

That being talked about, let’s try how one can merely add a preloader to your WordPress website online.

Methodology 1. Together with a Preloader in WordPress using WP Good Preloader

This system is basically useful because of it is easier to implement and does not require any modifications to your WordPress theme.

Very very first thing you need to do is about up and activate the WP Smart Preloader plugin.

Upon activation, you need to go to Settings » WP Good Preloader net web page to configure plugin settings.

wpsmartloader-settings-4797256

First, you need to choose a preloader trend or net web page load animation. The plugin comes with six built-in animations to pick from. You might also add your particular person custom-made HTML and CSS to create a custom-made preloader.

After that, it’s possible you’ll make the preloader appear solely on the homepage by checking the ‘Current solely on Home Internet web page’ chance.

Subsequent, you need to scroll all the way in which right down to the ‘Size to level out Loader’ half. That you will need to specify the interval for the preloader. The default chance is 1500 milliseconds (1.5 seconds) which should work for a lot of web sites, nonetheless you’ll change that when you want.

duration-4381896

You might also set the time loader takes to completely fade out. The default chance is 2500 seconds or 2.5 seconds.

Lastly, don’t neglect to click on on on the ‘Save modifications’ button to retailer your settings.

Now you’ll be able to go to your website online to see the preloader in movement.

wpsmartpreloder-preview-8764354

Methodology 2. Together with a Preloader in WordPress using Preloader Plugin

This system is flexible nonetheless requires additional steps to accurately implement it in your WordPress web site.

The very very first thing you need to do is about up and activate the Preloader plugin.

Upon activation, you need to go to the Plugins » Preloader net web page to configure plugin settings.

preloader-settings-9065229

First, you need to enter the Hex code for the background color it is advisable to use for the loading show. The default chance is #FFFFFF (white). It is best to use an web color picker software program to go looking out the HEX code for the color it is advisable to use.

Subsequent, you need to current the URL of the preloader image it is advisable to use. The plugin comes with a default animation image.

In case you want to use totally different animation, you then undoubtedly’ll uncover a hyperlink to acquire an animated preloader image from a third-party website online. You can then add that image to your wp-content folder and paste the URL proper right here.

Subsequent, you need to choose the place it is advisable to present the preloader.

wheretodisplaypreloader-7043278

You can choose to indicate it on all pages of your website online, or you’ll select a specific half.

Lastly, you’ll observe the instruction in order so as to add the following code to your WordPress theme’s header.php file.

1

Sooner than you permit the online web page, don’t neglect to click on on on the ‘Save modifications’ button to retailer your settings.

We don’t advocate together with code to your WordPress theme because of it ought to get wiped off whilst you change the theme.

In case you might be using a teen theme, then it is okay in order so as to add the code to your teen theme’s header.php file.

greater decision will be in order so as to add this code using a separate Code Snippets plugin or in a site-specific plugin.

Proper right here’s the code you’d need in order so as to add:

1

2

3

4

function wpb_add_preloader() {

echo '';

}

add_action( 'wp_body_open', 'wpb_add_preloader' );

Phrase: this method of together with code will solely work on WordPress themes which could be acceptable with the wp_body_open() function added in WordPress 5.2.

This system of together with the code makes optimistic that your code stays there even within the occasion you change the theme.

After getting added the code, you’ll go to your website online to see the preloader in movement.

preloader-preview-3064721

We hope this textual content helped you uncover methods to easily add a Preloader to your WordPress web site.

gp-4698209 as-3546051

WP Saviour

I am a WordPress specialist. My mission is to help you create beautiful websites with ease!