How to add a widget area to the bottom of every post.



This tutorial shows how to add a widget area to the bottom of every post.

On many sites you will find a standard text at the bottom of all WordPress posts. This is a great place to remind your readers about something you want them to do, a special promotion you are running, etc.
Next we will show you how to add a widget area to the bottom of every post.
Once you have the widget area in place, you can add any desired content to that area using the admin pages of WordPress.

1) Register the widget
First you need to tell WordPress you want a new widget to be available.
To do so, you need to add the following to your functions.php file, which is located in the root folder of your WordPress installation.

– functions.php

After you made this change, you can check that the new widget is available for configuration in the WordPress admin widget page.

In the admin section of WordPress go to “Appearence > Widgets” and find the new widget area “Bottom of Post Widget Area”.


– WordPress admin > Appearance > Widgets

Now you can drag any desired content to this widget area.
For example, drag a text widget into it:

The defined content will however not yet appear at the bottom of a post.
To do this we need to adjust the rendering of a singe post.

2) Adjust the rendering of a single post
To adjust the rendering of a singe post you need to change the file single.php, which is located in the root folder of your WordPress installation.
Add the following snippit to the single.php file

at the place as marked in bold below:

– single.php

Now refresh any of your posts and it should show the configured widget(s) below each of your posts.