Αναζήτηση

How to create a Widget Area in WordPress theme

Πηγή: http://wpgyan.com/how-to-create-a-widget-area-in-wordpress-theme/

A Blog for WordPress,Web Tutorials and Tips

How to create a Widget Area in WordPress theme

Widget Area is a part of a WordPress theme structure where Widgets can be added.Widget area is normally in right side of main content area or in left side of it.It can be created in header area of website,in footer area of website or in the middle of posts.Almost anywhere you want.
Widget areas also referred as Sidebars.

 

To add a Widget Go to Appearance > Widgets and Drag a Widget to a Widget Area.Here you can add available Widgets.

 

Most new themes are widgetized now.check your theme Widgets Section for that.Plugins also create Widgets to display contents or some special features.

 

So, Let?s start and create a widget area

 

Creating a Widget Area

 

There are two steps to create a Widget Area.

 

1. Registering a Widget Area

 

Add following code in your theme?s functions.php file.

 

 

Note: I have added prefix  wpgyan_  to function name at two places at top and at bottom.You can change to a prefix of your choice.

 

2. Display Widget Area

 

To display Widget Area add following code to location of your choice in your theme file.

 

 

Where:
header_sidebar is id of Widget area in Step 1.

 

To Preview  new created Widget Area you can go to Appearance > Widgets.There Must be a Widget area of name ?Header Sidebar?.

Multiple Widget areas can be registered using above code.Just use different id for each Widget Area.

Statistics

Articles View Hits
1044

CoalaWeb Traffic

Today1
Yesterday5
This week1
This month18
Total3363

Visitor IP : 35.174.62.162 Visitor Info : Unknown - Unknown Monday, 15 April 2024 08:26

Who Is Online

Guests : One guest online Members : No members online
Powered by CoalaWeb
The best bookmaker in the UK William Hill - whbonus.webs.com William Hill
Bokmakers www.artbetting.net website.
Get free Wordpress Templates - Wordpress - BIGTheme.net