Need to add a banner advert before your header area?
Here’s what it may look like:
In this post, i’ll provide 3 ways to add an image before your header area.
- The 1st solution creates a custom widget which works in any theme.
- The 2nd solution creates a widget which works in Genesis themes only
- The 3rd solution pulls an image from your images folder and works in any theme
There’s code below which works with any theme however you may choose to use your own themes hooks. The PHP is added to the end of your child themes functions file unless otherwise indicated.
1. Before Header Widget For Any Theme
This code creates a new widget which works in any theme.
Genesis/StudioPress Users #
Here’s the solution for Genesis users.
3. From Images Folder – Works in Any Theme
Simply add your image to your child themes images folder making sure the filename and extension match whats in the code.
Demo Image HTML for Beginners
Here’s the HTML i used in a new text widget in the new before header widget area the above PHP code creates.
Simply change the url to your own image and paste this code into your widget area.