Have you ever wanted to modify your WordPress site so that you could include images in the sidebar? If so, you soon realized that the sidebar will not natively host images. WordPress developers have always intended the sidebar to be used primarily for navigation, so they never implemented a function for images. But that shouldn’t stop you. There is a very easy work around.
Including images in the WordPress sidebar is essentially a two-step process:
- Add a customized widget
- Link that widget to your image
Adding the Widget
The first step can be completed with a few clicks. Log on to your WordPress site and go to the Dashboard. Then click on Appearance>Widgets to open the widgets page. Drag and drop a text widget to the sidebar of your choice. By the way, this same trick can be used to add images to the footer as well.
What you have now done is create a placeholder in the sidebar into which you can enter your own HTML code. The code itself is simply a link to the image you want displayed. It looks something like this:
<img src="the URL of your image" alt="any alternate text you want"/>
The URL of your image is the physical location of the image on the internet. The image could be in your WordPress library, as discussed below, or hosted on a completely different site altogether. As for the alternate text, this is text used as a placeholder while images are loading. It is not really necessary in the age of broadband, but some site owners still prefer to use alternate text for SEO purposes.
Using an Image in Your Library
We recommend using images in your library whenever possible. Why? Because library images load faster and, if necessary, you can edit them right from inside the library. If the image you want in your sidebar is not yet in the library, just upload it the way you would any other image. Now you need to know the URL.
Go to your media library and find the uploaded image. Click on it to open the details window. On the far-right side you should see a series of dialogue boxes – one of them contains the URL. Just copy the URL and paste it into your widget. Now save the widget and preview your site to make sure the changes have taken effect. If you did everything correctly, you should see your image right where you placed the widget.
If the image is too big or too small, you have a couple of options. You can use the embedded editor in WordPress to re-size the image in place. Alternatively, you can re-size the image on your desktop and then upload a new image and create a new link in your widget.
That’s all there is to it. Now you know how to put images in your sidebar even though WordPress developers have not yet added that function to the platform.