How to Include Random Header Images to Your WordPress Blog

Header images add beauty to your website. They can give a completely fresh look to your website. A right WordPress header image will not only change the appearance of your website but also change its finish. It is easy to add random images as most of the themes in WordPress come with support using which header images can be added. Here is a tutorial on how on how you could add header images to your WordPress blog.

WordPress themes both premium and free feature the custom header support. This is a feature that lets the themes of WordPress to label the space for header displaying an image. A custom header should not be confused with a background image that enables you to select an image that would be the background for your website. There are three easy ways of adding random WordPress header image.

Theme Customizer to add Random WordPress Header Image

This way is easy to follow and also suggested for WordPress users. To begin with go to Appearance where you need to select Customize from the drop down. Once done the WordPress theme customizer will be launched.

WordPress header image

On clicking the Header tab the page will expand. The header option could be displayed as header media or header image depending on the theme that you are using.

You would now be able to see the header image of your website. Along with it you would also be able to see other header images that are available.

On clicking the Add Image you will be able to upload the images that you wish to use as header images for your website.

On uploading the images, you would be able to see them in the recently uploaded images section.

After this you would have to hit on Randomize Uploaded Header which will be found in the recently uploaded images section and save all the changes made.

WordPress header image

Open your website once it is reloaded, you will be able to see that the WordPress Header Image is changing randomly.

Add Custom Header Images on Specific Pages With a Plugin

This way lets you regulate on how you want to show the random images for WordPress pages, tag archives, posts or category.

The plugin that is required here is the WP Display Header.  There are several other plugins that are available on the internet. However, this is one of the best plugins that will help you accomplish this task. The plugin should be installed according to the instructions. There is a step by step guideline on how you could install a WordPress plugin, it can be searched online.

Once the plugin is activated, you would require creating a new post or just editing the old one. Just below the post editor a new box with the name Header will be seen.

You can select a WordPress Header Image that has been uploaded earlier. This image can be used as the header image for the post you have created or edited. Also, the Random option can be selected to display an image for your website’s background from the header images that have been uploaded previously.

WordPress header image

If you are looking to adjoin more header images then you need to go to Appearance and select Customize, after this you need to click on the Header.

Add Image button would have to be clicked so you can upload the images that you need to add. The header of the theme need not be altered. All you need to do is upload the images and come out from the customizer.

You can also change the WordPress header image for your tag archive pages and category.

You just need to go to Posts and in the drop down that you get you would have to select Categories. In the Categories page you need to click on Edit button below category that has to be changed.

In the edit screen you will be able to see a new header segment where the desired header image can be selected or you could select show random header images.

Clicking on the Update button will let you save all the changes made to the screen.

Add Random Header Images Using Code

There are no plugins required in this method of adding random WordPress header image to your website or blog. To begin with, all the images that you want to see in the header area should be selected ensuring that all of them have the same extension. For instance if one image has a .jpg format then all of them should be in .jpg format. You do not want problems arising while you enter the code. So stick to one format to avoid any confusion in the next steps.

While putting them in the header they should be named in a sequence. For example header.image_1, header.image_2, header.image_3, header.image_4 and so on, depending on the number of images you take. The names should be separated with the underscore as seen in example. The prefix in the above example can be changed according to what you want.

Once the images are uploaded in the Header.php where you want your header image to show, you have to paste the code which is mentioned below.

WordPress header image

In the code rand(1,4) will generate any number between 1 and 4 along with the numbers 1 and 4. This is where the importance of numbering or naming as you would say, comes in. All you need to do is change the order number of images that would be the file name of images. This is easy to do.

Remember if the number of images are being changed in the header the numbers within the random function should also be changed. It functions on platform which is php based.

WordPress header image

The above three are easy ways of adding WordPress header image to your WordPress website. All the methods can be implemented by anyone without any hassles.

Leave a Reply