How to add a new widget area to your WordPress theme

Most WordPress Themes come by default with some pre-defined areas where you can drop your widgets in. But often this is not enough and you need to add additional areas, for example for advertising space or other features.

This is how to do it:

First Step: Add widget Area to Theme
In the index.php file in your theme directory (/wp-content/themes/mytheme), add the following code in the area where you would like a new widget to appear. Note we have had to wrap this line of code so it displays. Careful of too many spaces.


Second Step: Function.php

Put this line at the end of the function.php file:

register_sidebar(array('name'=>'Post Widget',));

Third Step: Style

Now you can style the new widget area via stylesheet, example:

.widget_post {
	background: #FFFFFF;
	margin: 0px;
	padding: 10px;
	width: 600px;
	}

And then go to the WordPress backend and look in the widget section for the newly created area and drop in your desired widget. That’s it 🙂

5 thoughts on “How to add a new widget area to your WordPress theme

Leave a Reply

Your email address will not be published. Required fields are marked *

x


Angebot anfordern

Ich melde mich innerhalb von 24 Stunden zurück.